You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/10/27 10:10:26 UTC

[2/2] git commit: CAMEL-7966 Doesn't set the blank or empty string to the mail recipients

CAMEL-7966 Doesn't set the blank or empty string to the mail recipients


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b98ce579
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b98ce579
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b98ce579

Branch: refs/heads/camel-2.13.x
Commit: b98ce5797b6e83fd32e4271e5aa0f4de91cbe11e
Parents: ed622eb
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Oct 27 17:05:01 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Oct 27 17:09:52 2014 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/mail/MailBinding.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b98ce579/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
index e93c49e..9b46695 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
@@ -581,7 +581,11 @@ public class MailBinding {
                                                      String type, String recipient) throws MessagingException, IOException {
         List<InternetAddress> recipientsAddresses = new ArrayList<InternetAddress>();
         for (String line : splitRecipients(recipient)) {
-            recipientsAddresses.add(asEncodedInternetAddress(line.trim(), determineCharSet(configuration, exchange)));
+            String address = line.trim();
+            // Only add the address which is not empty
+            if (ObjectHelper.isNotEmpty(address)) {
+                recipientsAddresses.add(asEncodedInternetAddress(address, determineCharSet(configuration, exchange)));
+            }
         }
 
         mimeMessage.addRecipients(asRecipientType(type), recipientsAddresses.toArray(new InternetAddress[recipientsAddresses.size()]));