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 2012/05/20 22:28:35 UTC
svn commit: r1340829 - in /ofbiz/branches/release11.04: ./
framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
Author: jleroux
Date: Sun May 20 20:28:34 2012
New Revision: 1340829
URL: http://svn.apache.org/viewvc?rev=1340829&view=rev
Log:
"Applied fix from trunk for revision: 1340826 "
------------------------------------------------------------------------
r1340826 | jleroux | 2012-05-20 22:27:23 +0200 (dim., 20 mai 2012) | 21 lines
A patch from Daniel Riquelme "ignore-if-empty in entity-options throw NPE when env-name is in fact empty" https://issues.apache.org/jira/browse/OFBIZ-4843
When specifying the ignore-if-empty attribute inside an entity-constraint in an entity-options a NPE will be thrown whenever the env-name of this entity-constraint is empty.
The error occurs because a null condition is created for the entity-constraint.
When validateSql get called in
org.ofbiz.entity.condition.EntityJoinOperator.validateSql(EntityJoinOperator.java:178)
there is no null checking so when
condition.checkCondition(modelEntity);
gets called an NPE is thrown.
The patch modifies the code in
framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
to avoid the inclusion of a null condition to the entity-options.
------------------------------------------------------------------------
Modified:
ofbiz/branches/release11.04/ (props changed)
ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1340826
Modified: ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1340829&r1=1340828&r2=1340829&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Sun May 20 20:28:34 2012
@@ -1751,7 +1751,10 @@ public class ModelFormField {
if (modelEntity == null) {
throw new IllegalArgumentException("Error in entity-options: could not find entity [" + this.entityName + "]");
}
- expandedConditionList.add(condition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity)));
+ EntityCondition createdCondition = condition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
+ if (createdCondition!=null) {
+ expandedConditionList.add(createdCondition);
+ }
}
findCondition = EntityCondition.makeCondition(expandedConditionList);
}