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

NPE in ELFlash.get() on first request #4431

Closed
spyrkob opened this issue Jul 27, 2018 · 10 comments
Closed

NPE in ELFlash.get() on first request #4431

spyrkob opened this issue Jul 27, 2018 · 10 comments
Assignees
Labels

Comments

@spyrkob
Copy link
Contributor

spyrkob commented Jul 27, 2018

ELFlash.get throws NPE in clustered apps when trying to access flash scope on first request.

Reproducer: test.tar.gz

Steps to reproduce:

Unzip & deploy attached app
curl -i http://localhost:8080/test/getvar.xhtml
Result:
26-Jul-2018 11:06:59.383 SEVERE [http-nio-8080-exec-13] com.sun.faces.application.view.FaceletViewHandlingStrategy.handleRenderException Error Rendering View[/getvar.xhtml] javax.el.ELException: /getvar.xhtml: java.lang.NullPointerException at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:89) at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:83) at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:211) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1908) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1908) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:491) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:194) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:126) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.get(ELFlash.java:420) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at javax.el.BeanELResolver.invoke(BeanELResolver.java:158) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:79) at org.apache.el.parser.AstValue.getValue(AstValue.java:159) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190) at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:258) at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:165) at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:86) ... 33 more

Expected:
#{flash.get('var')} should return null since the variable has not been set.

Note: this is a copy of javaserverfaces/mojarra#4379

@manfredriem
Copy link
Contributor

Which version of Mojarra is this targeting?

@spyrkob
Copy link
Contributor Author

spyrkob commented Aug 1, 2018

@manfredriem originally the issue was found on 2.3.5 version, but it also affects newer versions.
I opened the PR against 3.0 in #4432 and also a PR against 2.3.x branch in javaserverfaces/mojarra#4380

Please let me know if those are not the correct branches.

@arjantijms arjantijms self-assigned this Jul 28, 2019
@lprimak
Copy link

lprimak commented Oct 13, 2020

Getting this error as well

@lprimak
Copy link

lprimak commented Oct 13, 2020

The PR provided should fix the issue

@arjantijms
Copy link
Contributor

Unfortunately the PR didn't pass the IP check :(

@spyrkob
Copy link
Contributor Author

spyrkob commented Oct 13, 2020

Oh sorry @arjantijms I didn't notice the failure. I'll fix it tomorrow morning

@arjantijms
Copy link
Contributor

Thanks a lot! :)

spyrkob added a commit to spyrkob/ee4j-mojarra that referenced this issue Oct 14, 2020
spyrkob added a commit to spyrkob/ee4j-mojarra that referenced this issue Dec 9, 2020
spyrkob added a commit to spyrkob/ee4j-mojarra that referenced this issue Jan 4, 2021
arjantijms added a commit that referenced this issue Mar 26, 2021
[#4431] NPE in ELFlash.get() on first request
arjantijms added a commit that referenced this issue Mar 27, 2021
[#4431] NPE in ELFlash.get() on first request
@mnriem mnriem added the 2.3 label Nov 27, 2021
@melloware
Copy link
Contributor

This is fixed and deployed shouldn't this ticket be closed?

@lprimak
Copy link

lprimak commented May 24, 2022

@arjantijms :)

@arjantijms
Copy link
Contributor

Thanks for the ping ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants