Volodymyr Siedlecki created MYFACES-4431:
--------------------------------------------
Summary: 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
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)