myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <neum...@ijet.com>
Subject NPE in Required Initialization for labels addon (property version)
Date Wed, 27 Oct 2010 15:30:59 GMT
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