Author: jleroux
Date: Thu Apr  5 09:29:30 2012
New Revision: 1309718

URL: http://svn.apache.org/viewvc?rev=1309718&view=rev
Log:
"Applied fix from trunk for revision: 1309715" 
------------------------------------------------------------------------
r1309715 | jleroux | 2012-04-05 11:27:24 +0200 (jeu., 05 avr. 2012) | 5 lines

A patch from Paul Foxworthy https://issues.apache.org/jira/browse/OFBIZ-4784 
"storeIncomingEmail assumes variable is not null when it might be"

In storeIncomingEmail in CommunicationEventServices.java, the code to assemble 
the aboutThisEmail debugging message assumes addressesFrom and addressesTo are 
not null. But the methods that return values for those variables might return 
null if they encounter an exception.

Removes also uses of UtilValidate.isEmpty, which should only be used for 
collections and sequences (see OFBIZ-4427).
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release10.04/   (props changed)
    
ofbiz/branches/release10.04/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java

Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1309715

Modified: 
ofbiz/branches/release10.04/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1309718&r1=1309717&r2=1309718&view=diff
==============================================================================
--- 
ofbiz/branches/release10.04/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
 (original)
+++ 
ofbiz/branches/release10.04/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
 Thu Apr  5 09:29:30 2012
@@ -671,8 +671,9 @@ public class CommunicationEventServices 
             String messageId = wrapper.getMessageId();
 
             String aboutThisEmail = "message [" + messageId + "] from [" +
-                (addressesFrom[0] == null? "not found" : 
addressesFrom[0].toString()) + "] to [" +
-                (addressesTo[0] == null? "not found" : 
addressesTo[0].toString()) + "]";
+                    ((addressesFrom == null || addressesFrom[0] == null) ? 
"not found" : addressesFrom[0].toString()) + "] to [" +
+                    ((addressesTo == null || addressesTo[0] == null) ? "not 
found" : addressesTo[0].toString()) + "]";
+
             if (Debug.verboseOn()) Debug.logVerbose("Processing Incoming Email 
" + aboutThisEmail, module);
 
             // ignore the message when the spam status = yes
@@ -1042,7 +1043,7 @@ public class CommunicationEventServices 
             }
         }
 
-        if (!UtilValidate.isEmpty(emailAddress)) {
+        if (emailAddress != null) {
             map = FastMap.newInstance();
             map.put("address", emailAddress.getAddress());
             map.put("userLogin", userLogin);
@@ -1065,7 +1066,7 @@ public class CommunicationEventServices 
                 if (addr instanceof InternetAddress) {
                     emailAddress = (InternetAddress)addr;
 
-                    if (!UtilValidate.isEmpty(emailAddress)) {
+                    if (emailAddress != null) {
                         result = 
dispatcher.runSync("findPartyFromEmailAddress",
                                 UtilMisc.toMap("address", 
emailAddress.getAddress(), "userLogin", userLogin));
                         if (result.get("partyId") != null) {
@@ -1092,7 +1093,7 @@ public class CommunicationEventServices 
                 if (addr instanceof InternetAddress) {
                     emailAddress = (InternetAddress)addr;
 
-                    if (!UtilValidate.isEmpty(emailAddress)) {
+                    if (emailAddress != null) {
                         Map<String, String> inputFields = 
FastMap.newInstance();
                         inputFields.put("infoString", 
emailAddress.getAddress());
                         inputFields.put("infoString_ic", caseInsensitiveEmail);


Reply via email to