myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Uribe <lu4...@gmail.com>
Subject Re: JSF 2.1.3: default Myfaces error handling cannot deal with a null component.getValueExpression(name)
Date Tue, 29 Nov 2011 04:16:39 GMT
Hi

Any option is ok. Most of the times it returns something, so just
output the attribute with empty string seems good.

regards,

Leonardo

2011/11/28 Mike Kienenberger <mkienenb@gmail.com>:
> I'm debugging a JSF application which is being upgraded from JSF
> 1.2+Richfaces 3.3 to JSF 2.1+Richfaces4.1.
> When it hits an error, I get sent to the default MyFaces error handling.
>
> I'm noticing that the default error handling is hitting an NPE in
> org.apache.myfaces.renderkit.ErrorPageWriter:line 1305 on the
> valueExpression
> org.richfaces.application.GlobalResourcesViewHandler$SkinningResourceRenderedExpression
> for "rendered" on the __rf_skinning_resource UIOutput automatically
> being handled in the <head> tag.
>
>                        valueExpression = c.getValueExpression(pd[i].getName());
>                        if (valueExpressionValues && valueExpression
!= null)
>                        {
>                            _writeAttribute(writer, pd[i].getName(),
> valueExpression.getExpressionString());
>                        }
>
> This expression string is hardcoded to return null (subclass of
> org.richfaces.el.BaseReadOnlyValueExpression).
>
> From what I can tell, it's legal for a value expression to return null.
>
> http://docs.oracle.com/javaee/5/api/javax/el/Expression.html#getExpressionString%28%29
>
> In any case, since this is an error handling routine, it should
> probably be more flexible in handling unexpected values.
>
> What do we want to do in this case?
>
> We could skip outputting the attribute.
>
> We could output the attribute with empty string as the value
> expression.   In this particular case, we could check for isReadOnly()
> and if true, output getValue().   Not sure if we'd want to do that in
> the case of !isReadOnly().  In fact, I'm not entirely certain we want
> to be evaluating getValue().
>
> We could output the class of the value expression.
>

Mime
View raw message