webtier@glassfish.java.net

faces-config with from-outcome not being string fails with NullPointerException

From: <useyour.mind_at_gmail.com>
Date: Mon, 26 May 2014 12:14:18 +0000 (UTC)

(I've posted this too @stackoverflow:
http://stackoverflow.com/q/23776638/1099452)

I've been using JSF 2.1 with mojarra-2.1.20, and I've configured in my
faces-config.xml a navigation case like this:

<navigation-rule>
    <from-view-id>/loggedOut.xhtml</from-view-id>
    <navigation-case>
        <from-action>#{sessionManager.isLoggedIn}</from-action>
        <from-outcome>true</from-outcome>
        <to-view-id>/login.xhtml</to-view-id>
        <redirect />
    </navigation-case>
</navigation-rule>

The action is executed using seam-faces viewAction (similiar to JSF 2.2
new tag). All has been working fine.

Today I've upgraded to JSF 2.2 with mojarra-2.2.6, and browsing to the
view loggedOut.xhtml stoped working. It throws this stacktrace:

java.lang.NullPointerException
    at
com.sun.faces.application.NavigationHandlerImpl.determineViewFromAction
Outcome(NavigationHandlerImpl.java:1342)
    at
com.sun.faces.application.NavigationHandlerImpl.findExactMatch(Navigati
onHandlerImpl.java:603)
    at
com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHan
dlerImpl.java:481)
    at
com.sun.faces.application.NavigationHandlerImpl.getNavigationCase(Navig
ationHandlerImpl.java:149)
    at
com.sun.faces.application.NavigationHandlerImpl.getNavigationCase(Navig
ationHandlerImpl.java:140)
    at
org.jboss.seam.faces.event.SeamPreNavigationHandler.getNavigationCase(S
eamPreNavigationHandler.java:42)
    at
org.jboss.seam.faces.event.SeamPreNavigationHandler.handleNavigation(Se
amPreNavigationHandler.java:57)
    at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListen
erImpl.java:132)
    at
org.jboss.seam.faces.component.UIViewAction.broadcast(UIViewAction.java
:381)
    at
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at
javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
    at
com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestVal
uesPhase.java:78)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    ...

I have more navigations like this, and all of them fail in the same
way. The only difference between this navigations and other cases and
examples is that from-outcome value is a boolean and not a String. So
my questions are:

1. Should from-outcome's fail when it is not a String?
1.1. If so, should not fail with a more "readable" message?
1.2. Else, is a mojara bug?
2. Version 2.1 was wrong then?

I know how to "fix it": using a {dummyAction.execute} and checking the
boolean in the <if> tag. But I prefered to execute the real action and
not 2 differents.