This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-email.git
The following commit(s) were added to refs/heads/master by this push: new a71a9f3 Lookup key in map only once a71a9f3 is described below commit a71a9f3264cdabf55b97e5bf0fc2cbe33b35e1e0 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Nov 30 11:18:19 2022 -0500 Lookup key in map only once --- src/main/java/org/apache/commons/mail/HtmlEmail.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/mail/HtmlEmail.java b/src/main/java/org/apache/commons/mail/HtmlEmail.java index 4a7ca94..98fdffd 100644 --- a/src/main/java/org/apache/commons/mail/HtmlEmail.java +++ b/src/main/java/org/apache/commons/mail/HtmlEmail.java @@ -260,9 +260,9 @@ public class HtmlEmail extends MultiPartEmail // check if a URLDataSource for this name has already been attached; // if so, return the cached CID value. - if (inlineEmbeds.containsKey(name)) + final InlineImage ii = inlineEmbeds.get(name); + if (ii != null) { - final InlineImage ii = inlineEmbeds.get(name); final URLDataSource urlDataSource = (URLDataSource) ii.getDataSource(); // make sure the supplied URL points to the same thing // as the one already associated with this name. @@ -368,9 +368,9 @@ public class HtmlEmail extends MultiPartEmail // check if a FileDataSource for this name has already been attached; // if so, return the cached CID value. - if (inlineEmbeds.containsKey(file.getName())) + final InlineImage ii = inlineEmbeds.get(file.getName()); + if (ii != null) { - final InlineImage ii = inlineEmbeds.get(file.getName()); final FileDataSource fileDataSource = (FileDataSource) ii.getDataSource(); // make sure the supplied file has the same canonical path // as the one already associated with this name. @@ -427,9 +427,9 @@ public class HtmlEmail extends MultiPartEmail { // check if the DataSource has already been attached; // if so, return the cached CID value. - if (inlineEmbeds.containsKey(name)) + final InlineImage ii = inlineEmbeds.get(name); + if (ii != null) { - final InlineImage ii = inlineEmbeds.get(name); // make sure the supplied URL points to the same thing // as the one already associated with this name. if (dataSource.equals(ii.getDataSource()))