Details
Description
I had an backing bean class with the following property:
@Property{value="#
{param.enrollmentId}")private Long enrollmentId;
And this ends up that shale calls the
getAsObject method javax.faces.convert.LongConverter of MyFaces-1.1.5-SNAPSHOT during the restore view phase .
This method expects an uiComponent not null otherwise it throws a
NullPointerException. But this method is called by the
org.apache.shale.util.ConverterHelper during create view and therefore
the facesContext setViewRoot is still null. So the below code of the ConverterHelper
end ups in a NullPointerException in this situation.
public Object asObject(FacesContext context, Class type, String value) {
if (String.class == type) { return value; }
return converter(context, type).getAsObject(context,context.getViewRoot(), value);
}
There are also some other parts in the ConverterHelper class that depends on that viewRoot is not null.
Well the jsf - 1.1 spec says that the getAsObject method is called during the apply request values phase.
As far as I understood it myfaces doesn't use the converter to initialize the beans also. Instead it uses the Coercions class of common-el to convert #{param.enrollmentId}
.
Btw.: As workaround, define your own ConverterClass that can handle that the component parameter is null.
- Ingo