You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/12/15 20:29:28 UTC

(commons-email) 01/04: Internal redo of InlineImage equals/hashCode

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

commit 7ad61cf260c44caadd8d9ba908a6b9bfb5c7e0f8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Dec 15 14:47:34 2023 -0500

    Internal redo of InlineImage equals/hashCode
---
 src/main/java/org/apache/commons/mail/HtmlEmail.java | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/commons/mail/HtmlEmail.java b/src/main/java/org/apache/commons/mail/HtmlEmail.java
index c647084..fa6869e 100644
--- a/src/main/java/org/apache/commons/mail/HtmlEmail.java
+++ b/src/main/java/org/apache/commons/mail/HtmlEmail.java
@@ -108,20 +108,16 @@ public class HtmlEmail extends MultiPartEmail {
             this.mimeBodyPart = Objects.requireNonNull(mimeBodyPart, "mimeBodyPart");
         }
 
-        /**
-         * {@inheritDoc}
-         *
-         * @return true if the other object is also an InlineImage with the same cid.
-         */
         @Override
-        public boolean equals(final Object obj) {
+        public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
             }
             if (!(obj instanceof InlineImage)) {
                 return false;
             }
-            return this.cid.equals(((InlineImage) obj).cid);
+            InlineImage other = (InlineImage) obj;
+            return Objects.equals(cid, other.cid);
         }
 
         /**
@@ -151,14 +147,9 @@ public class HtmlEmail extends MultiPartEmail {
             return mimeBodyPart;
         }
 
-        /**
-         * {@inheritDoc}
-         *
-         * @return the cid hashCode.
-         */
         @Override
         public int hashCode() {
-            return cid.hashCode();
+            return Objects.hash(cid);
         }
     }