Author: jleroux
Date: Mon Nov 14 08:15:50 2011
New Revision: 1201627
URL:
http://svn.apache.org/viewvc?rev=1201627&view=revLog:
A patch from Deepak Dixit for "View entity condition-expr doesn't handle null"
https://issues.apache.org/jira/browse/OFBIZ-4393condition-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/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
Modified: ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=1201627&r1=1201626&r2=1201627&view=diff==============================================================================
--- ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Mon Nov 14 08:15:50 2011
@@ -1230,8 +1230,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