FacesConfig.getCurrentInstance and externalContext references should work
before set application instance on facesContext init
------------------------------------------------------------------------------------------------------------------------------
Key: MYFACES-2232
URL: https://issues.apache.org/jira/browse/MYFACES-2232
Project: MyFaces Core
Issue Type: Bug
Reporter: Leonardo Uribe
Assignee: Leonardo Uribe
Stack trace:
java.lang.NullPointerException
at
org.apache.myfaces.application.ApplicationImpl.internalGetRuntimeConfig(ApplicationImpl.java:150)
at
org.apache.myfaces.application.ApplicationImpl.(ApplicationImpl.java:130)
at
org.apache.myfaces.application.ApplicationFactoryImpl.createAndLogNewApplication(ApplicationFactoryImpl.java:52)
at
org.apache.myfaces.application.ApplicationFactoryImpl.(ApplicationFactoryImpl.java:48)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:170)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:136)
at
org.apache.myfaces.context.servlet.FacesContextImpl.(FacesContextImpl.java:95)
at
org.apache.myfaces.context.servlet.FacesContextImpl.(FacesContextImpl.java:88)
at
org.apache.myfaces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:63)
The solution is change constructor to this:
private FacesContextImpl(final ReleaseableExternalContext externalContext)
{
_externalContext = externalContext;
FacesContext.setCurrentInstance(this); //protected method, therefore
must be called from here
_application =
((ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY))
.getApplication();
_renderKitFactory = (RenderKitFactory)
FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.