Author: jacopoc Date: Tue Jan 6 07:43:00 2015 New Revision: 1649742 URL: http://svn.apache.org/r1649742 Log: OFBIZ-5944: before trying to pull the values for the form's fields, check if the key exists in order to avoid an IllegalArgumentException if the map is a GenericEntity. Thanks to Christian Carlow for the report and to Deepak Dixit for the research and useful comments.
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1649742&r1=1649741&r2=1649742&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Tue Jan 6 07:43:00 2015 @@ -289,7 +289,6 @@ public class ModelFormField { } Object retVal = null; if (UtilValidate.isNotEmpty(this.entryAcsr)) { - //Debug.logInfo("Getting entry, using entryAcsr for field " + this.getName() + " of form " + this.modelForm.getName(), module); if (dataMap instanceof GenericEntity) { GenericEntity genEnt = (GenericEntity) dataMap; if (genEnt.getModelEntity().isField(this.entryAcsr.getOriginalName())) { @@ -301,9 +300,10 @@ public class ModelFormField { retVal = this.entryAcsr.get(dataMap, locale); } } else { - //Debug.logInfo("Getting entry, no entryAcsr so using field name " + this.name + " for field " + this.getName() + " of form " + this.modelForm.getName(), module); // if no entry name was specified, use the field's name - retVal = dataMap.get(this.name); + if (dataMap.containsKey(this.name)) { + retVal = dataMap.get(this.name); + } } // this is a special case to fill in fields during a create by default from parameters passed in