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

PrettyFaces causes NPE in applications using MyFaces 2.2 and Faces Flows #284

Open
wtlucy opened this issue Jul 31, 2019 · 0 comments
Open

Comments

@wtlucy
Copy link

wtlucy commented Jul 31, 2019

Applications using JSF 2.2 Faces Flows and MyFaces don't work with PrettyFaces. This NPE is thrown:

java.lang.NullPointerException
	at org.apache.myfaces.application.NavigationHandlerImpl.getNavigationCaseFromFlowStructure(NavigationHandlerImpl.java:905)
	at org.apache.myfaces.application.NavigationHandlerImpl.getNavigationCommand(NavigationHandlerImpl.java:720)
	at org.apache.myfaces.application.NavigationHandlerImpl.getNavigationCase(NavigationHandlerImpl.java:394)
	at com.ocpsoft.pretty.faces2.application.PrettyNavigationHandler.getNavigationCase(PrettyNavigationHandler.java:121)
	at org.ocpsoft.rewrite.faces.RewriteNavigationHandler.getNavigationCase(RewriteNavigationHandler.java:116)
	at org.apache.myfaces.shared.renderkit.html.util.OutcomeTargetUtils.getOutcomeTargetHref(OutcomeTargetUtils.java:81)
	at org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils.getOutcomeTargetHref(HtmlRendererUtils.java:1602)
	at org.apache.myfaces.shared.renderkit.html.HtmlLinkRendererBase.renderOutcomeLinkStart(HtmlLinkRendererBase.java:1006)
	at org.apache.myfaces.shared.renderkit.html.HtmlLinkRendererBase.encodeBegin(HtmlLinkRendererBase.java:145)
	at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:597)
	at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:527)

It looks to me like PrettyFaces doesn't correctly register Flows in its PrettyNavigationHandler. PrettyNavigationHandler extends ConfigurableNavigationHandler, however it doesn't do anything with the inspectFlow method that was added in JSF 2.2. To resolve this, PrettyNavigationHandler should probably override inspectFlow and delegate to its parent, since the default implementation of inspectFlow is a no-op.

I've created a sample branch that reproduces this issue: https://github.com/wtlucy/jsf22-examples/tree/prettyfaces_issue/jsf22-flows

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

No branches or pull requests

1 participant