james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject svn commit: r1720543 - /james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailAdapter.java
Date Thu, 17 Dec 2015 13:06:44 GMT
Author: btellier
Date: Thu Dec 17 13:06:44 2015
New Revision: 1720543

URL: http://svn.apache.org/viewvc?rev=1720543&view=rev
Log:
JAMES-1620 getEnvelopeTo should return first not null address

Modified:
    james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailAdapter.java

Modified: james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailAdapter.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailAdapter.java?rev=1720543&r1=1720542&r2=1720543&view=diff
==============================================================================
--- james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailAdapter.java
(original)
+++ james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailAdapter.java
Thu Dec 17 13:06:44 2015
@@ -17,21 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 package org.apache.jsieve.mailet;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.mail.Header;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -52,6 +37,20 @@ import org.apache.jsieve.mail.optional.E
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
+
+import javax.mail.Header;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 /**
  * <p>
  * Class <code>SieveMailAdapter</code> implements a <code>MailAdapter</code>
@@ -314,11 +313,13 @@ public class SieveMailAdapter implements
      */
     public String getEnvelopeTo()
     {
-        String recipient = null;
-        Iterator recipientIter = getMail().getRecipients().iterator();
-        if (recipientIter.hasNext())
-            recipient = recipientIter.next().toString();
-        return recipient;
+        for (MailAddress mailAddress : getMail().getRecipients()) {
+            String recipient = mailAddress.toInternetAddress().getAddress();
+            if (recipient != null) {
+                return recipient;
+            }
+        }
+        return null;
     }
     
     /**



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


Mime
View raw message