camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1004889 - in /camel/trunk/components/camel-mail/src: main/java/org/apache/camel/component/mail/MailBinding.java test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
Date Wed, 06 Oct 2010 03:53:23 GMT
Author: hadrian
Date: Wed Oct  6 03:53:22 2010
New Revision: 1004889

URL: http://svn.apache.org/viewvc?rev=1004889&view=rev
Log:
CAMEL-3199. Patch applied with thanks to Tracy Snell

Modified:
    camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
    camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java

Modified: camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java?rev=1004889&r1=1004888&r2=1004889&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
(original)
+++ camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
Wed Oct  6 03:53:22 2010
@@ -554,7 +554,8 @@ public class MailBinding {
         throws MessagingException {
 
         // we support that multi recipient can be given as a string separated by comma or
semicolon
-        String[] lines = recipient.split("[,;]");
+        // regex ignores comma and semicolon inside of double quotes
+        String[] lines = recipient.split("[,;]++(?=(?:(?:[^\\\"]*+\\\"){2})*+[^\\\"]*+$)");
         for (String line : lines) {
             line = line.trim();
             mimeMessage.addRecipients(asRecipientType(type), line);

Modified: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java?rev=1004889&r1=1004888&r2=1004889&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
(original)
+++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
Wed Oct  6 03:53:22 2010
@@ -37,12 +37,13 @@ public class MailMultipleRecipientsTest 
         // START SNIPPET: e1
         Map<String, Object> headers = new HashMap<String, Object>();
         // test with both comma and semi colon as Camel supports both kind of separators
-        headers.put("to", "claus@localhost, willem@localhost ; hadrian@localhost");
+        headers.put("to", "claus@localhost, willem@localhost ; hadrian@localhost, \"Snell,
Tracy\" <tracy@localhost>");
         headers.put("cc", "james@localhost");
 
         assertMailbox("claus");
         assertMailbox("willem");
         assertMailbox("hadrian");
+        assertMailbox("tracy");
 
         template.sendBodyAndHeaders("smtp://localhost", "Hello World", headers);
         // END SNIPPET: e1
@@ -81,6 +82,8 @@ public class MailMultipleRecipientsTest 
                 from("pop3://willem@localhost?consumer.delay=1000").to("mock:willem");
 
                 from("pop3://hadrian@localhost?consumer.delay=1000").to("mock:hadrian");
+
+                from("pop3://tracy@localhost?consumer.delay=1000").to("mock:tracy");
             }
         };
     }



Mime
View raw message