You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volodymyr Siedlecki (Jira)" <de...@myfaces.apache.org> on 2022/04/01 02:57:00 UTC

[jira] [Comment Edited] (MYFACES-4431) Custom Navigation Handler Thows NPE during Flow Handling

    [ https://issues.apache.org/jira/browse/MYFACES-4431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515675#comment-17515675 ] 

Volodymyr Siedlecki edited comment on MYFACES-4431 at 4/1/22 2:56 AM:
----------------------------------------------------------------------

I've created an sample app demonstrating the issue here: [https://github.com/volosied/MYFACES-4431] (run on java 8)

My proposed solution is to return if flowNavigationStructure is null? Null would have been returned anyways.  This fix seems enough (without causing regressions).

[https://github.com/apache/myfaces/pull/238]   Thoughts?

Also, I looked at Mojarra, and it doesn't exhibit this NPE as their implementation is different from ours.


was (Author: volosied):
I've created an sample app demonstrating the issue here: [https://github.com/volosied/MYFACES-4431] (run on java 8) 

My proposed solution is to return if flowNavigationStructure is null?  That seems enough (without causing regressions). 

[https://github.com/apache/myfaces/pull/238]   Thoughts? 

Also, I looked at Mojarra, and it doesn't exhibit this NPE as their implementation is different from ours.

> Custom Navigation Handler Thows NPE during Flow Handling
> --------------------------------------------------------
>
>                 Key: MYFACES-4431
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4431
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-344, JSR-372
>            Reporter: Volodymyr Siedlecki
>            Priority: Major
>
> When entering a flow while using a custom navigation handler, the following NPE occur:
> {quote}java.lang.NullPointerException org.apache.myfaces.application.NavigationHandlerImpl.getNavigationCaseFromFlowStructure(NavigationHandlerImpl.java:958) org.apache.myfaces.application.NavigationHandlerImpl.getNavigationCommand(NavigationHandlerImpl.java:773) org.apache.myfaces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:133) org.apache.myfaces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:121) org.primefaces.application.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:113) org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:140) org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:54) javax.faces.component.UICommand.broadcast(UICommand.java:120) javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1255) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:420) javax.faces.component.UIViewRoot._process(UIViewRoot.java:1741) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:935) org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:42) org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195) org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142) javax.faces.webapp.FacesServlet.service(FacesServlet.java:204)
> {quote}
> My testing used the "org.primefaces.application.DialogNavigationHandler" ([link|https://github.com/primefaces/primefaces/blob/8.0/src/main/java/org/primefaces/application/DialogNavigationHandler.java]) from PrimeFaces.
> ______
> Typically, the Flow navigations would be added here in NavigationHandlerImpl#inspectFlow: [https://github.com/apache/myfaces/blob/2.3.x/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java#L1490-L1492]
> However, since DialogNavigationHandler is a sub class of ConfigurableNavigationHandler, the inspectFlow (empty method) is called on the super class instead. See methods here:
> [https://github.com/apache/myfaces/blob/2.3.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java#L784]
> [https://github.com/apache/myfaces/blob/2.3.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandler.java#L54]
> Since _flowNavigationStructureMap is empty, an null (from the get call) is passed into getNavigationCaseFromFlowStructure which causes the NPE.
> [https://github.com/apache/myfaces/blob/2.3.x/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java#L771-L774]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)