Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4431

Custom NavigationHandler throws NPE during flow handling

    XMLWordPrintableJSON

Details

    Description

      When entering a flow while using a custom navigation handler, the following NPE occur:

      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)

      My testing used the "org.primefaces.application.DialogNavigationHandler" (link) 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

      Attachments

        Activity

          People

            volosied Volodymyr Siedlecki
            volosied Volodymyr Siedlecki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: