Skip to content
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

ResourceUtils.filterStylesheets throws NPE if resource is not found (null) #1808

Closed
gako opened this issue Oct 4, 2016 · 2 comments
Closed
Assignees
Labels
6.0.7 enhancement Additional functionality to current component
Milestone

Comments

@gako
Copy link
Contributor

gako commented Oct 4, 2016

ResourceUtils.java Line 91

resource = resourceHandler.createResource
...
stylesheets.add(**resource**.getRequestPath());

In special cases a resourceHandler can return null for a resource if it is not found... In this case the resourceUtils class throws a Nullpointer exception. It would be nice if this is handled gracefully.

if (resource!=null) {
stylesheets.add(**resource**.getRequestPath());
}

StrackeTrace of Exception
java.lang.NullPointerException
at org.primefaces.util.ResourceUtils.filterStylesheets(ResourceUtils.java:96)
at org.primefaces.context.PrimePartialResponseWriter.startMetadataIfNecessary(PrimePartialResponseWriter.java:287)
at org.primefaces.context.PrimePartialResponseWriter.startUpdate(PrimePartialResponseWriter.java:142)
at org.omnifaces.context.OmniPartialViewContext$OmniPartialResponseWriter.startUpdate(OmniPartialViewContext.java:323)
at com.sun.faces.context.PartialViewContextImpl.renderState(PartialViewContextImpl.java:482)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:325)
at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:57)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
at org.omnifaces.context.OmniPartialViewContext.processPartial(OmniPartialViewContext.java:144)
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.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:115)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
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)

1) Environment

  • PrimeFaces version: 6.0.5
  • Application server + version: Paraya 4.1.1.165 (GF 4.1.1)
  • Affected browsers: Serverside error

2) Expected behavior

Not available resource is gracefully ignored

3) Actual behavior

NullPointerException is thrown

4) Steps to reproduce

Open a page that required additional resources during an action. Then make sure the session is lost in the background (session timeout, server restart,...)
..

@gako
Copy link
Contributor Author

gako commented Oct 4, 2016

The same is probably also true for ResourceUtils.filterScripts (line 119) but I havn't encouterd this yet.

@tandraschko tandraschko self-assigned this Oct 7, 2016
tandraschko added a commit that referenced this issue Oct 8, 2016
@tandraschko tandraschko added this to the 6.1 milestone Oct 8, 2016
@tandraschko tandraschko added the enhancement Additional functionality to current component label Oct 8, 2016
@tandraschko
Copy link
Member

So we should

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.0.7 enhancement Additional functionality to current component
Projects
None yet
Development

No branches or pull requests

3 participants