ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase. ------------------------------------------------------------------------------------------------------------------------------
Key: SHALE-406 URL: https://issues.apache.org/struts/browse/SHALE-406 Project: Shale Issue Type: Bug Components: View Affects Versions: 1.0.4 Environment: Facelets 1.1.12, MyFaces 1.1.5-SNAPSHOT , Tomahawk 1.1.5-SNAPSHOT Reporter: Ingo Dueppe 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 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.