myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <neum...@ijet.com>
Subject RE: NPE in Required Initialization for labels addon (property version)
Date Thu, 28 Oct 2010 14:21:34 GMT
Great, I see the change in the bean-validation version. 
Don't forget the property version ;)
 
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -117,8 +117,11 @@
         }
         else
         {
+            String value = (String) uiOutput.getValue();
+            if (value != null) {
             applyRequiredMarkerUsingValue(facesContext, uiOutput, (String) uiOutput.getValue());
         }
+        }
         if (setEscapeToFalse)
         {
             doSetEscapeToFalse(uiOutput);

--Ben

-----Original Message-----
From: Gerhard [mailto:gerhard.petracek@gmail.com]
Sent: Wednesday, October 27, 2010 6:32 PM
To: MyFaces Development
Subject: Re: NPE in Required Initialization for labels addon (property version)


thx ben - i've committed it. 

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




2010/10/27 < neumanb@ijet.com>


This null-check was also needed in the Bean Validation version.
 
Thanks!
Ben

-----Original Message-----
From: Ben Neuman 
Sent: Wednesday, October 27, 2010 11:31 AM
To: 'MyFaces Development'
Subject: NPE in Required Initialization for labels addon (property version)


I had to make a small change in the Required Initialization for labels (property version)
to resolve a NullPointerException.
 
In DefaultRequiredLabelInitializer I added a null value check. Without, I was getting NullPointerExceptions.
 
protected void applyRequiredMarker(FacesContext facesContext, UIOutput uiOutput) 
{
    ValueExpression expression = uiOutput.getValueExpression("value");
 
        if (expression != null)
        {
            applyRequiredMarkerUsingExpression(facesContext, uiOutput, expression.getExpressionString());
        }
        else
        {
            String value = (String) uiOutput.getValue();
            if (value != null) {                
                applyRequiredMarkerUsingValue(facesContext, uiOutput, value);
            }
        }
        ...
}
 
Thanks!
Ben



Mime
View raw message