You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2011/09/05 13:03:45 UTC

Re: svn commit: r1165233 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Why not using UtilValidate.isNotEmpty(this.description)? It's not yet build at this stage?

Jacques

> Author: adrianc
> Date: Mon Sep  5 10:47:32 2011
> New Revision: 1165233
>
> URL: http://svn.apache.org/viewvc?rev=1165233&view=rev
> Log:
> Fix NPE I introduced in my previous commit. Reported by Chatree Srichart.
>
> 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=1165233&r1=1165232&r2=1165233&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 Mon Sep  5 10:47:32 2011
> @@ -2127,7 +2127,7 @@ public class ModelFormField {
>
>         public String getDescription(Map<String, Object> context) {
>             String retVal = null;
> -            if (!this.description.isEmpty()) {
> +            if (this.description != null && !this.description.isEmpty()) {
>                 retVal = this.description.expandString(context);
>             } else {
>                 retVal = this.modelFormField.getEntry(context);
> @@ -2213,7 +2213,7 @@ public class ModelFormField {
>                     throw new IllegalArgumentException(errMsg);
>                 }
>             }
> -            if (!this.description.isEmpty() && retVal != null && this.getModelFormField().getEncodeOutput()) {
> +            if (this.description != null && !this.description.isEmpty() && retVal != null && 
> this.getModelFormField().getEncodeOutput()) {
>                 StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
>                 if (simpleEncoder != null) {
>                     retVal = simpleEncoder.encode(retVal);
>
>