james-server-dev mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1720542&view=rev
Log:
JAMES-1620 Addresses should be well retrieved from headers

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=1720542&r1=1720541&r2=1720542&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:05:50 2015
@@ -393,14 +393,23 @@ public class SieveMailAdapter implements
     
     public Address[] parseAddresses(String arg) throws SieveMailException, InternetAddressException
{
         try {
-            final MailboxList list = new AddressList(DefaultAddressParser.DEFAULT.parseAddressList(arg),
true).flatten();
-            final int size = list.size();
+            List<String> headerValues = getHeader(arg);
+            List<MailboxList> mailboxes = new ArrayList<MailboxList>();
+            int size = 0;
+            for(String headerValue : headerValues) {
+                MailboxList mailboxList = new AddressList(DefaultAddressParser.DEFAULT.parseAddressList(headerValue),
true).flatten();
+                size += mailboxList.size();
+                mailboxes.add(mailboxList);
+            }
+            int i = 0;
             final Address[] results = new Address[size];
-            for (int i=0;i<size;i++) {
-                final Mailbox mailbox = list.get(i);
-                results[i] = new AddressImpl(mailbox.getLocalPart(), mailbox.getDomain());
+            for(MailboxList mailboxList : mailboxes) {
+                for(Mailbox mailbox : mailboxList) {
+                    results[i] = new AddressImpl(mailbox.getLocalPart(), mailbox.getDomain());
+                    i++;
+                }
             }
-            return null;
+            return results;
         } catch (ParseException e) {
             throw new InternetAddressException(e);
         }



---------------------------------------------------------------------
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