svn commit: r1856667 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1856667 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java

jleroux@apache.org
Author: jleroux
Date: Sun Mar 31 09:14:16 2019
New Revision: 1856667

URL: http://svn.apache.org/viewvc?rev=1856667&view=rev
Log:
Fixed: EmailServices.sendMail causes a NPE, when sendFrom is missing
(OFBIZ-10706)

I tried to find the history for why the service does not take the
defaultFromEmailAddress property from general.properties and I found that It was
last modified in revision r418498 on 02/07/2006, I think it was always broken.

This uses defaultFromEmailAddress property in sendMail if sendFrom is missing

Thanks: Pawan Verma and others for discussion

Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java?rev=1856667&r1=1856666&r2=1856667&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java Sun Mar 31 09:14:16 2019
@@ -160,6 +160,9 @@ public class EmailServices {
         }
 
         String sendFrom = (String) context.get("sendFrom");
+        if (UtilValidate.isEmpty(sendFrom)) {
+            sendFrom = EntityUtilProperties.getPropertyValue("general", "defaultFromEmailAddress", delegator);
+        }
         String sendType = (String) context.get("sendType");
         String port = (String) context.get("port");
         String socketFactoryClass = (String) context.get("socketFactoryClass");