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

Random Exception when null resourceName #174

Open
maeichris opened this Issue Oct 6, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@maeichris

maeichris commented Oct 6, 2017

Random users are getting an error on a web site I've built that uses JSF 2.2, PrimeFaces 6.0, and OpenFaces 3.0. It appears to be caused by a null resourceName. I'm not sure why resourceName is null, but it would be nice if OpenFaces dealt a little better with it.

My suggested fix in OpenFacesResourceHandler is:

    private boolean isExternalResource(String resourceName) {
        return resourceName != null && resourceName.contains("://");
    }

Exception follows:

javax.faces.event.AbortProcessingException: java.lang.NullPointerException
    at org.primefaces.context.PrimePartialResponseWriter.startMetadataIfNecessary(PrimePartialResponseWriter.java:303)
    at org.primefaces.context.PrimePartialResponseWriter.startUpdate(PrimePartialResponseWriter.java:142)
    at com.sun.faces.context.PartialViewContextImpl.renderState(PartialViewContextImpl.java:482)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:325)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
    at org.openfaces.ajax.PartialViewContext.processPartial(PartialViewContext.java:131)
    at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:57)
    at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1004)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:432)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:651)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:385)
    at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:267)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
    at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by
java.lang.NullPointerException
    at org.openfaces.application.OpenFacesResourceHandler.isExternalResource(OpenFacesResourceHandler.java:96)
    at org.openfaces.application.OpenFacesResourceHandler.createResource(OpenFacesResourceHandler.java:51)
    at javax.faces.application.ResourceHandlerWrapper.createResource(ResourceHandlerWrapper.java:85)
    at org.primefaces.util.ResourceUtils.filterScripts(ResourceUtils.java:114)
    at org.primefaces.context.PrimePartialResponseWriter.startMetadataIfNecessary(PrimePartialResponseWriter.java:293)
    ... 35 more

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