Hi Andrianc. This patch causes the null pointer exception. Could you also
check the this.description object if it is NULL value before calling the isEmpty() method? Regards, Chatree Srichart On Sun, Sep 4, 2011 at 8:26 PM, <[hidden email]> wrote: > Author: adrianc > Date: Sun Sep 4 13:26:57 2011 > New Revision: 1165011 > > URL: http://svn.apache.org/viewvc?rev=1165011&view=rev > Log: > 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; > } > > > > |
Thank you for pointing that out. I thought I checked the code thoroughly
and determined that the FlexibleStringExpander instance is never null. I will look at it again. -Adrian On 9/5/2011 11:16 AM, Chatree Srichart wrote: > Hi Andrianc. This patch causes the null pointer exception. Could you also > check the this.description object if it is NULL value before calling the > isEmpty() method? > > Regards, > Chatree Srichart > > On Sun, Sep 4, 2011 at 8:26 PM,<[hidden email]> wrote: > >> Author: adrianc >> Date: Sun Sep 4 13:26:57 2011 >> New Revision: 1165011 >> >> URL: http://svn.apache.org/viewvc?rev=1165011&view=rev >> Log: >> 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; >> } >> >> >> >> |
Free forum by Nabble | Edit this page |