svn commit: r928272 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

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

svn commit: r928272 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

lektran
Author: lektran
Date: Sat Mar 27 21:00:24 2010
New Revision: 928272

URL: http://svn.apache.org/viewvc?rev=928272&view=rev
Log:
Move a couple of null checks higher to where they can actually be reached

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=928272&r1=928271&r2=928272&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Sat Mar 27 21:00:24 2010
@@ -749,6 +749,10 @@ public class GenericDelegator implements
     public GenericValue createSetNextSeqId(GenericValue value) throws GenericEntityException {
         boolean doCacheClear = true;
 
+        if (value == null) {
+            throw new GenericEntityException("Cannot create a null value");
+        }
+
         GenericHelper helper = getEntityHelper(value.getEntityName());
         // just make sure it is this delegator...
         value.setDelegator(this);
@@ -764,10 +768,6 @@ public class GenericDelegator implements
             EntityEcaRuleRunner<?> ecaRunner = this.getEcaRuleRunner(value.getEntityName());
             ecaRunner.evalRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_CREATE, value, false);
 
-            if (value == null) {
-                throw new GenericEntityException("Cannot create a null value");
-            }
-
             ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_CREATE, value, false);
 
             value.setDelegator(this);
@@ -855,12 +855,13 @@ public class GenericDelegator implements
                 beganTransaction = TransactionUtil.begin();
             }
 
-            EntityEcaRuleRunner<?> ecaRunner = this.getEcaRuleRunner(value.getEntityName());
-            ecaRunner.evalRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_CREATE, value, false);
-
             if (value == null) {
                 throw new GenericEntityException("Cannot create a null value");
             }
+
+            EntityEcaRuleRunner<?> ecaRunner = this.getEcaRuleRunner(value.getEntityName());
+            ecaRunner.evalRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_CREATE, value, false);
+
             GenericHelper helper = getEntityHelper(value.getEntityName());
 
             ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_CREATE, value, false);