svn commit: r1765051 - /ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java

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

svn commit: r1765051 - /ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java

Mridul Pathak-5
Author: mridulpathak
Date: Sat Oct 15 12:45:35 2016
New Revision: 1765051

URL: http://svn.apache.org/viewvc?rev=1765051&view=rev
Log:
Applied fix from trunk for revision: 1765048
==

Fixed: Entity ECA rules throws NPE in case of remove operation.
(OFBIZ-8001)

Thanks: Suraj Khurana for contribution.

Modified:
    ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java

Modified: ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java?rev=1765051&r1=1765050&r2=1765051&view=diff
==============================================================================
--- ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java (original)
+++ ofbiz/branches/release14.12/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java Sat Oct 15 12:45:35 2016
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntity;
@@ -134,8 +135,10 @@ public final class EntityEcaRule impleme
         if( !fieldsToLoad.isEmpty()) {
             Delegator delegator = dctx.getDelegator();
             GenericValue oldValue =  delegator.findOne(entityName, value.getPrimaryKey(), false);
-            for( String fieldName : fieldsToLoad) {
-                value.put(fieldName, oldValue.get(fieldName));
+            if(UtilValidate.isNotEmpty(oldValue)) {
+                for (String fieldName : fieldsToLoad) {
+                    value.put(fieldName, oldValue.get(fieldName));
+                }
             }
         }