You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/05/08 20:57:58 UTC
svn commit: r1480407 -
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
Author: adrianc
Date: Wed May 8 18:57:58 2013
New Revision: 1480407
URL: http://svn.apache.org/r1480407
Log:
Fixed an exception in the form widget - reported by Jacques on the dev mailing list.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1480407&r1=1480406&r2=1480407&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Wed May 8 18:57:58 2013
@@ -21,6 +21,7 @@ package org.ofbiz.widget.form;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -46,6 +47,7 @@ import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.collections.FlexibleMapAccessor;
import org.ofbiz.base.util.collections.MapStack;
import org.ofbiz.base.util.string.FlexibleStringExpander;
+import org.ofbiz.entity.GenericEntity;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelField;
@@ -1518,7 +1520,13 @@ public class ModelForm extends ModelWidg
if (UtilValidate.isNotEmpty(this.getListEntryName())) {
localContext.put(this.getListEntryName(), item);
} else {
- localContext.push(itemMap);
+ if (itemMap instanceof GenericEntity) {
+ // Rendering code might try to modify the GenericEntity instance,
+ // so we make a copy of it.
+ localContext.push(new HashMap<String, Object>(itemMap));
+ } else {
+ localContext.push(itemMap);
+ }
}
// reset/remove the BshInterpreter now as well as later because chances are there is an interpreter at this level of the stack too