[ 
http://issues.apache.org/jira/browse/MYFACES-210?page=comments#action_12357285 
] 

Ken Weiner commented on MYFACES-210:
------------------------------------

I am experiencing the same issue.  See mailing list thread: 
http://www.mail-archive.com/users%40myfaces.apache.org/msg11719.html

Since my Application is not an ApplicationImpl, FacesConfigurator doesn't 
inject the configuration into ApplicationImpl and then when MyApplication 
delegates to ApplicationImpl, ApplicationImpl throws a NullPointerException in 
this code because it has a registered converter but not the corresponding 
configuration:

private Converter internalCreateConverter(Class targetClass) {
....
                Converter converter = (Converter) converterClass.newInstance();

                org.apache.myfaces.config.impl.digester.elements.Converter 
converterConfig =
                        
(org.apache.myfaces.config.impl.digester.elements.Converter)
                            
_converterClassNameToConfigurationMap.get(converterClass.getName());

                Iterator it = converterConfig.getProperties(); <-- a NPE is 
thrown here because converterConfig is null
....
}

The result is this stack trace.  My application is "SpringApplication":

Caused by: javax.faces.FacesException: Could not instantiate converter: class 
javax.faces.convert.IntegerConverter
    at 
org.apache.myfaces.application.ApplicationImpl.internalCreateConverter(ApplicationImpl.java:556)
    at 
org.apache.myfaces.application.ApplicationImpl.createConverter(ApplicationImpl.java:494)
    at 
org.lmb.web.jsf.SpringApplication.createConverter(SpringApplication.java:287)
    ... 34 more
Caused by: java.lang.NullPointerException
    at 
org.apache.myfaces.application.ApplicationImpl.internalCreateConverter(ApplicationImpl.java:534)
    ... 36 more



> Undesired dependency on ApplicationImpl in FacesConfigurator
> ------------------------------------------------------------
>
>          Key: MYFACES-210
>          URL: http://issues.apache.org/jira/browse/MYFACES-210
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.0.9m9
>  Environment: Custom ApplicationFactory and Application Objects
>     Reporter: Walter Snel
>     Assignee: Martin Marinschek
>     Priority: Minor

>
> Manfred's recent additions related to the configurability of Converters 
> created a dependency on a particular Application implementation in the 
> FacesConfigurator.
> I noticed this because I'm using a custom ApplicationFactory that returns a 
> custom Facade (with augmentations) to the ApplicationImpl class.
> In this case the FacesConfigurator doesn't call the 
> addConverterConfiguration. This, later on, leads to horrible nullpointer 
> exceptions when any of standard converters are used. Perhaps we could 
> consider using relfection instead of the current 'instanceof' mechanism to 
> find out if the addConverterConfiguration() method is supported ?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to