New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException within RichFaces when using UnmappedResourceHandler #297

Closed
torgre opened this Issue Aug 8, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@torgre

torgre commented Aug 8, 2016

When enabling the UnmappedResourceHandler (using faces-config.xml and web.xmlsettings as explained in OmniFaces Javadoc) and also having enabled RichFaces resourceOptimization using org.richfaces.resourceOptimization.enabledset to true a NullPointerException is thrown:

java.lang.NullPointerException
        at org.richfaces.skin.SkinFactoryImpl.clearSkinCaches(SkinFactoryImpl.java:95)
        at org.richfaces.skin.SkinFactoryPreRenderViewListener.processEvent(SkinFactoryPreRenderViewListener.java:35)
        at javax.faces.event.SystemEvent.processListener(SystemEvent.java:40)
        at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:51)
        at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2595)
        at org.apache.myfaces.application.ApplicationImpl.access$000(ApplicationImpl.java:129)
        at org.apache.myfaces.application.ApplicationImpl$SystemListenerEntry.publish(ApplicationImpl.java:2784)
        at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:610)
        at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:625)
        at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:334)
        at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:334)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:84)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
        at org.richfaces.webapp.ResourceServlet.httpService(ResourceServlet.java:129)
        at org.richfaces.webapp.ResourceServlet.service(ResourceServlet.java:123)
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)

The path the application tries to load is /portal/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/plain/packed/packed.css (portal is the context path).

The null pointer occures because FacesContext.getCurrentInstance() returns null when org.richfaces.skin.SkinFactoryPreRenderViewListener.processEvent(SystemEvent) is called.

I was not able isolate the issue in OmniFaces directly, however I saw the following Hack for PrimeFaces in org.omnifaces.resourcehandler.UnmappedResourceHandler.createResource(FacesContext):

if (Hacks.isPrimeFacesDynamicResourceRequest(context)) {
    return null;
}

Using a similar approach for RichFaces did not work though (checking for the string org.richfaces.staticResource from the requested path and also returning null).

OmniFaces 2.4 and 2.5 from master used. RichFaces version 4.5.17 used on WildFly 10.0.0.Final with Apache MyFaces 2.2.8.

@torgre

This comment has been minimized.

Show comment
Hide comment
@torgre

torgre Aug 9, 2016

Update: it has nothing to do with resourceOptimization, same exception also occurs on every request to each RichFaces resource when it is disabled.

torgre commented Aug 9, 2016

Update: it has nothing to do with resourceOptimization, same exception also occurs on every request to each RichFaces resource when it is disabled.

@BalusC BalusC closed this in a167c33 Aug 10, 2016

@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC Aug 10, 2016

Member

Reproduced. Fix is available in today's 2.5-SNAPSHOT. Can you let me know if that works out for you as well?

Member

BalusC commented Aug 10, 2016

Reproduced. Fix is available in today's 2.5-SNAPSHOT. Can you let me know if that works out for you as well?

@torgre

This comment has been minimized.

Show comment
Hide comment
@torgre

torgre Aug 11, 2016

Works like a charm, thank you very much for the quick fix 👍

torgre commented Aug 11, 2016

Works like a charm, thank you very much for the quick fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment