manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject svn commit: r1791819 - in /manifoldcf/trunk: CHANGES.txt connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
Date Tue, 18 Apr 2017 18:19:10 GMT
Author: kamaci
Date: Tue Apr 18 18:19:10 2017
New Revision: 1791819

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

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

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1791819&r1=1791818&r2=1791819&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Tue Apr 18 18:19:10 2017
@@ -11,6 +11,9 @@ commit to trunk.
 
 ======================= Release 2.7 =====================
 
+CONNECTORS-1412: Fix null "to" recipient bug at email connector.
+(Furkan KAMACI)
+
 CONNECTORS-1411: Fix attachment URL template reset bug.
 (Furkan KAMACI)
 

Modified: manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java?rev=1791819&r1=1791818&r2=1791819&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
(original)
+++ manifoldcf/trunk/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
Tue Apr 18 18:19:10 2017
@@ -599,13 +599,15 @@ public class EmailConnector extends org.
               for (String metadata : requiredMetadata) {
                 if (metadata.toLowerCase(Locale.ROOT).equals(EmailConfig.EMAIL_TO)) {
                   Address[] to = msg.getRecipients(Message.RecipientType.TO);
-                  String[] toStr = new String[to.length];
-                  int j = 0;
-                  for (Address address : to) {
-                    toStr[j] = useEmailExtractor ? extractEmailAddress(address.toString())
: address.toString();
-                    j++;
+                  if (to != null) {
+                    String[] toStr = new String[to.length];
+                    int j = 0;
+                    for (Address address : to) {
+                      toStr[j] = useEmailExtractor ? extractEmailAddress(address.toString())
: address.toString();
+                      j++;
+                    }
+                    rd.addField(EmailConfig.EMAIL_TO, toStr);
                   }
-                  rd.addField(EmailConfig.EMAIL_TO, toStr);
                 } else if (metadata.toLowerCase(Locale.ROOT).equals(EmailConfig.EMAIL_FROM))
{
                   Address[] from = msg.getFrom();
                   String[] fromStr = new String[from.length];
@@ -834,13 +836,15 @@ public class EmailConnector extends org.
               for (String metadata : requiredMetadata) {
                 if (metadata.toLowerCase(Locale.ROOT).equals(EmailConfig.EMAIL_TO)) {
                   Address[] to = msg.getRecipients(Message.RecipientType.TO);
-                  String[] toStr = new String[to.length];
-                  int j = 0;
-                  for (Address address : to) {
-                    toStr[j] = useEmailExtractor ? extractEmailAddress(address.toString())
: address.toString();
-                    j++;
+                  if (to != null) {
+                    String[] toStr = new String[to.length];
+                    int j = 0;
+                    for (Address address : to) {
+                      toStr[j] = useEmailExtractor ? extractEmailAddress(address.toString())
: address.toString();
+                      j++;
+                    }
+                    rd.addField(EmailConfig.EMAIL_TO, toStr);
                   }
-                  rd.addField(EmailConfig.EMAIL_TO, toStr);
                 } else if (metadata.toLowerCase(Locale.ROOT).equals(EmailConfig.EMAIL_FROM))
{
                   Address[] from = msg.getFrom();
                   String[] fromStr = new String[from.length];



Mime
View raw message