You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2017/11/16 14:19:53 UTC

[06/18] james-project git commit: JAMES-2220 be consistent when setting recipients in MailImpl

JAMES-2220 be consistent when setting recipients in MailImpl


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8d0a70de
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8d0a70de
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8d0a70de

Branch: refs/heads/master
Commit: 8d0a70de1f885da53d4e7f8c1d7d9c4e3c1e1572
Parents: 05e5da3
Author: Matthieu Baechler <ma...@apache.org>
Authored: Tue Nov 14 15:45:13 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Thu Nov 16 12:30:30 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/james/server/core/MailImpl.java    | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8d0a70de/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java
----------------------------------------------------------------------
diff --git a/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java b/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java
index 07aed83..d146a07 100644
--- a/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java
+++ b/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java
@@ -51,6 +51,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
 
 /**
  * <p>
@@ -142,6 +143,7 @@ public class MailImpl implements Disposable, Mail {
         setState(Mail.DEFAULT);
         attributes = new HashMap<>();
         perRecipientSpecificHeaders = new PerRecipientHeaders();
+        this.recipients = null;
     }
 
     /**
@@ -156,12 +158,10 @@ public class MailImpl implements Disposable, Mail {
         this();
         this.name = name;
         this.sender = sender;
-        this.recipients = null;
 
         // Copy the recipient list
         if (recipients != null) {
-            this.recipients = new ArrayList<>();
-            this.recipients.addAll(recipients);
+            setRecipients(recipients);
         }
     }
 
@@ -397,14 +397,9 @@ public class MailImpl implements Disposable, Mail {
         }
     }
 
-    /**
-     * Set the recipients for this MailImpl.
-     *
-     * @param recipients the recipients for this MailImpl
-     */
     @Override
     public void setRecipients(Collection<MailAddress> recipients) {
-        this.recipients = recipients;
+        this.recipients = ImmutableList.copyOf(recipients);
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org