If folks have a moment, please review the attached patch.  I just want to be
extra paranoid about the change.  It is intended to optimize the two
boundary conditions where a matcher returns ALL or NONE.

The impact of this patch can be seen from:

Without:

31/05/03 23:04:47 Checking Mail1054436556483-30007 with
[EMAIL PROTECTED]
31/05/03 23:06:43 Servicing Mail1054436553472-30006 by ToProcessor Mailet

and

31/05/03 23:51:22 Checking Mail1054439349927-50009 with
[EMAIL PROTECTED]
31/05/03 23:52:24 Servicing Mail1054439349927-50009 by RemoteDelivery Mailet


With:

01/06/03 02:31:53 Checking Mail1054449100454-1 with [EMAIL PROTECTED]
01/06/03 02:31:53 Servicing Mail1054449100454-1 by ToProcessor Mailet
01/06/03 02:31:59 Checking Mail1054449100454-1 with [EMAIL PROTECTED]
01/06/03 02:31:59 Servicing Mail1054449100454-1 by RemoteDelivery Mailet

The recipient lists were huge, as one might expect from a large, active,
list server.

So far my tests look good, I think the code is right.  As I said, I'm just
being extra cautious.

        --- Noel
Index: src/java/org/apache/james/transport/LinearProcessor.java
===================================================================
RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/LinearProcessor.java,v
retrieving revision 1.10.4.2
diff -u -r1.10.4.2 LinearProcessor.java
--- src/java/org/apache/james/transport/LinearProcessor.java    8 Mar 2003 21:54:07 
-0000       1.10.4.2
+++ src/java/org/apache/james/transport/LinearProcessor.java    1 Jun 2003 17:23:53 
-0000
@@ -73,7 +73,6 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Random;
-import java.util.Vector;
 import java.util.Iterator;
 
 /**
@@ -369,19 +368,25 @@
             try {
                 recipients = matcher.match(mail);
                 if (recipients == null) {
-                    //In case the matcher returned null, create an empty Vector
-                    recipients = new Vector();
+                    //In case the matcher returned null, create an empty Collection
+                    recipients = new ArrayList(0);
+                } else if (recipients != mail.getRecipients()) {
+                    //Make sure all the objects are MailAddress objects
+                    verifyMailAddresses(recipients);
                 }
-                //Make sure all the objects are MailAddress objects
-                verifyMailAddresses(recipients);
             } catch (MessagingException me) {
                 handleException(me, mail, 
matcher.getMatcherConfig().getMatcherName());
             }
+
             // Split the recipients into two pools.  notRecipients will contain the
             // recipients on the message that the matcher did not return.
-            Collection notRecipients = new Vector();
-            notRecipients.addAll(mail.getRecipients());
-            notRecipients.removeAll(recipients);
+            Collection notRecipients;
+            if (recipients == mail.getRecipients() || recipients.size() == 0) {
+                notRecipients = new ArrayList(0);
+            } else {
+                notRecipients = new ArrayList(mail.getRecipients());
+                notRecipients.removeAll(recipients);
+            }
 
             if (recipients.size() == 0) {
                 //Everything was not a match... store it in the next spot in the array

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to