Details
Description
In testing the Liferay Faces bridge with his own samples, Neil found that one them that was working with our 3.0.1 release is now failing with the 3.1.0-RC1 release. The problem is that when, after successfully filling out the form, clicking submit should result in a non-redirect navigation to a new view. While this worked with the 3.0.1 release, it now causes:
(note, line numbers may not match as this stack trace is from classes that have extra debugging lines in them)
java.lang.NullPointerException
at org.icefaces.impl.util.DOMUtils.printNode(DOMUtils.java:291)
at org.icefaces.impl.util.DOMUtils.printNodeCDATA(DOMUtils.java:278)
at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:189)
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at com.liferay.faces.bridge.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:45)
at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:115)
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:115)
at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:178)
(note, line numbers may not match as this stack trace is from classes that have extra debugging lines in them)
java.lang.NullPointerException
at org.icefaces.impl.util.DOMUtils.printNode(DOMUtils.java:291)
at org.icefaces.impl.util.DOMUtils.printNodeCDATA(DOMUtils.java:278)
at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:189)
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at com.liferay.faces.bridge.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:45)
at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:115)
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:115)
at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:178)
I could reproduce the behaviour initially reported by Neil and it looked like it was related to navigation and our PropagatingNavigationHandler.
The form submission triggers a non-redirect navigation (to a thank-you type confirmation screen after the form has been successfully filled out). For this type of navigation, we rely on storing the original DOM in the view map and pulling it out to do the comparison and then basically replacing the contents of the body. The DOM is put into the view map in PropagatingNavigationHandler.handleNavigation():
...
{ viewMap.put(DOMResponseWriter.OLD_DOM, oldDOM); }NavigationCase navigationCase = getNavigationCase(context, fromAction, outcome);
if (navigationCase != null && !navigationCase.isRedirect()) {
viewMap = viewRoot.getViewMap();
viewMap.putAll(propagated);
if (null != oldDOM)
...
Logging the various bits before and after the NavigationHandlers have all run:
PropagatingNavigationHandler.handleNavigation: PRE
{applicantBackingBean.submit}oldDOM get: [#document: null]
view root : com.liferay.faces.bridge.component.UIViewRootBridgeImpl@61fa0030
from : #
outcome : success
20:34:53,493 DEBUG [ViewHandlerImpl:55] Creating view for viewId=[/views/confirmation.xhtml]
PropagatingNavigationHandler.handleNavigation: POST
oldDOM get: null
view root : com.liferay.faces.bridge.component.UIViewRootBridgeImpl@1b541798
from : #{applicantBackingBean.submit}
outcome : success
PropagatingNavigationHandler.handleNavigation
navigation case: null
The navigationCase is currently coming back null so the oldDOM is not being added back in to the new view map for the new view root. However, this behaviour was the same as with ICEfaces 3.0.1 and I went back and confirmed that the example app works with that version. So this is not the actual problem.