You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2011/11/14 09:16:00 UTC

svn commit: r1201628 - /ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java

Author: jleroux
Date: Mon Nov 14 08:16:00 2011
New Revision: 1201628

URL: http://svn.apache.org/viewvc?rev=1201628&view=rev
Log:
A patch from Deepak Dixit for "View entity condition-expr doesn't handle null" https://issues.apache.org/jira/browse/OFBIZ-4393

condition-expr tag in view-entity can't be used to compare a field with null. An absent value attribute is read as an empty string, and the code currently checks for value being null to know when to compare against null.

Modified:
    ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java

Modified: ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=1201628&r1=1201627&r2=1201628&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Mon Nov 14 08:16:00 2011
@@ -1224,8 +1224,18 @@ public class ModelViewEntity extends Mod
 
             this.operator = UtilFormatOut.checkEmpty(conditionExprElement.getAttribute("operator"), "equals");
             this.relEntityAlias = conditionExprElement.getAttribute("rel-entity-alias");
-            this.relFieldName = conditionExprElement.getAttribute("rel-field-name");
-            this.value = conditionExprElement.getAttribute("value");
+            String relFieldNameStr = conditionExprElement.getAttribute("rel-field-name");
+            if (UtilValidate.isEmpty(relFieldNameStr)) {
+                this.relFieldName = null;
+            } else {
+                this.relFieldName = relFieldNameStr;
+            }
+            String valueStr = conditionExprElement.getAttribute("value");
+            if (UtilValidate.isEmpty(valueStr)) {
+                this.value = null;
+            } else {
+                this.value = valueStr;
+            }
             this.ignoreCase = "true".equals(conditionExprElement.getAttribute("ignore-case"));
 
             // if we are in a view-link, default to the entity-alias and rel-entity-alias there