Author: norman
Date: Sat Sep 17 18:01:09 2011
New Revision: 1172032

URL: http://svn.apache.org/viewvc?rev=1172032&view=rev
Log:
Copy the recipients collection before try to modify it. See JAMES-1318

Modified:
    
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java

Modified: 
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=1172032&r1=1172031&r2=1172032&view=diff
==============================================================================
--- 
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
 (original)
+++ 
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
 Sat Sep 17 18:01:09 2011
@@ -1067,7 +1067,8 @@ public class RemoteDelivery extends Gene
         } catch (SendFailedException sfe) {
             logSendFailedException(sfe);
 
-            Collection<MailAddress> recipients = mail.getRecipients();
+            // Copy the recipients as direct modification may not be possible
+            Collection<MailAddress> recipients = new 
ArrayList<MailAddress>(mail.getRecipients());
 
             boolean deleteMessage = false;
 
@@ -1139,6 +1140,9 @@ public class RemoteDelivery extends Gene
                             log("Can't parse invalid address: " + 
pe.getMessage());
                         }
                     }
+                    // Set the recipients for the mail
+                    mail.setRecipients(recipients);
+                    
                     if (isDebug)
                         log("Invalid recipients: " + recipients);
                     deleteMessage = failMessage(mail, sfe, true);
@@ -1159,6 +1163,8 @@ public class RemoteDelivery extends Gene
                             log("Can't parse unsent address: " + 
pe.getMessage());
                         }
                     }
+                    // Set the recipients for the mail
+                    mail.setRecipients(recipients);
                     if (isDebug)
                         log("Unsent recipients: " + recipients);
                     if 
(sfe.getClass().getName().endsWith(".SMTPSendFailedException")) {
@@ -1169,7 +1175,8 @@ public class RemoteDelivery extends Gene
                     }
                 }
             }
-
+            
+           
             return deleteMessage;
         } catch (MessagingException ex) {
             // We should do a better job checking this... if the failure is a



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

Reply via email to