You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2016/10/15 12:36:30 UTC

svn commit: r1765048 - /ofbiz/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java

Author: mridulpathak
Date: Sat Oct 15 12:36:30 2016
New Revision: 1765048

URL: http://svn.apache.org/viewvc?rev=1765048&view=rev
Log:
Fixed: Entity ECA rules throws NPE in case of remove operation.
(OFBIZ-8001)

Thanks: Suraj Khurana for contribution.

Modified:
    ofbiz/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java

Modified: ofbiz/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java?rev=1765048&r1=1765047&r2=1765048&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java (original)
+++ ofbiz/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java Sat Oct 15 12:36:30 2016
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.base.util.UtilXml;
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.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));
+                }
             }
         }