Author: adrianc
Date: Sun Sep 4 13:26:57 2011
New Revision: 1165011
URL:
http://svn.apache.org/viewvc?rev=1165011&view=revLog:
Fixed a ModelFormField bug introduced in rev 1075322 - date and date-time form fields were throwing exceptions because the description Strings were HTML encoded before being converted to other types. I moved the HTML encoding to post-conversion.
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=1165011&r1=1165010&r2=1165011&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 Sun Sep 4 13:26:57 2011
@@ -2127,14 +2127,8 @@ public class ModelFormField {
public String getDescription(Map<String, Object> context) {
String retVal = null;
- if (this.description != null && !this.description.isEmpty()) {
+ if (!this.description.isEmpty()) {
retVal = this.description.expandString(context);
- if (retVal != null && this.getModelFormField().getEncodeOutput()) {
- StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
- if (simpleEncoder != null) {
- retVal = simpleEncoder.encode(retVal);
- }
- }
} else {
retVal = this.modelFormField.getEntry(context);
}
@@ -2219,6 +2213,12 @@ public class ModelFormField {
throw new IllegalArgumentException(errMsg);
}
}
+ if (!this.description.isEmpty() && retVal != null && this.getModelFormField().getEncodeOutput()) {
+ StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
+ if (simpleEncoder != null) {
+ retVal = simpleEncoder.encode(retVal);
+ }
+ }
return retVal;
}