manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sch...@apache.org
Subject svn commit: r1784646 - in /manifoldcf/trunk: CHANGES.txt connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConnector.java
Date Mon, 27 Feb 2017 20:21:46 GMT
Author: schuch
Date: Mon Feb 27 20:21:46 2017
New Revision: 1784646

URL: http://svn.apache.org/viewvc?rev=1784646&view=rev
Log:
Fix for CONNECTORS-1389

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConnector.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1784646&r1=1784645&r2=1784646&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Feb 27 20:21:46 2017
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.7-dev =====================
 
+CONNECTORS-1389: The email notification connector now supports
+multiple comma separated recipients
+(Markus Schuch)
+
 CONNECTORS-1388: The User ID field is now focused when the login
 page is loaded
 (Markus Schuch)

Modified: manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConnector.java?rev=1784646&r1=1784645&r2=1784646&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConnector.java
(original)
+++ manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConnector.java
Mon Feb 27 20:21:46 2017
@@ -22,16 +22,11 @@ package org.apache.manifoldcf.crawler.no
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
 import org.apache.manifoldcf.core.interfaces.*;
-import org.apache.manifoldcf.core.util.URLEncoder;
-import org.apache.manifoldcf.crawler.interfaces.*;
 import org.apache.manifoldcf.crawler.system.Logging;
 
 import java.io.*;
 import java.util.*;
 import javax.mail.*;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.search.*;
 
 /**
 */
@@ -265,7 +260,7 @@ public class EmailConnector extends org.
     for (int i = 0; i < spec.getChildCount(); i++) {
       SpecificationNode sn = spec.getChild(i);
       if (sn.getType().equals(EmailConfig.NODE_TO))
-        to.add(sn.getAttributeValue(EmailConfig.ATTRIBUTE_VALUE));
+        to.addAll(splitAtCommaAndTrim(sn.getAttributeValue(EmailConfig.ATTRIBUTE_VALUE)));
       else if (sn.getType().equals(EmailConfig.NODE_FROM))
         from = sn.getAttributeValue(EmailConfig.ATTRIBUTE_VALUE);
       else if (sn.getType().equals(EmailConfig.NODE_SUBJECT))
@@ -282,8 +277,9 @@ public class EmailConnector extends org.
         {
           for (int j = 0; j < childNode.getChildCount(); j++) {
             SpecificationNode sn = childNode.getChild(j);
-            if (sn.getType().equals(EmailConfig.NODE_TO))
-              to.add(sn.getAttributeValue(EmailConfig.ATTRIBUTE_VALUE));
+            if (sn.getType().equals(EmailConfig.NODE_TO)) {
+              to.addAll(splitAtCommaAndTrim(sn.getAttributeValue(EmailConfig.ATTRIBUTE_VALUE)));
+            }
             else if (sn.getType().equals(EmailConfig.NODE_FROM))
               from = sn.getAttributeValue(EmailConfig.ATTRIBUTE_VALUE);
             else if (sn.getType().equals(EmailConfig.NODE_SUBJECT))
@@ -311,6 +307,14 @@ public class EmailConnector extends org.
       handleMessagingException(e,"sending email");
     }
   }
+  
+  private List<String> splitAtCommaAndTrim(String input) {
+    List<String> result = new ArrayList<>();
+    if (input != null) {
+      result.addAll(Arrays.asList(input.split("\\s*,\\s*")));
+    }
+    return result;
+  }
 
 
   //////////////////////////////End of Notification Connector Methods///////////////////////////////////



Mime
View raw message