Details
Description
Note: This issue is also being tracked at the Liferay issue tracker under [FACES-2867|https://issues.liferay.com/browse/FACES-2867].
h3. Problem Description:
The BridgeSetup.java and BridgeFormsSetup.java classes assume that the "org.icefaces.impl.event::ViewState" attribute will always be be non-null. Because of this assumption, NullPointerException is being thrown in a portlet environment during a portlet mode change. This is because of a requirement in JSR 329/378 that prevents "non excluded" request attributes from surviving from the ACTION_PHASE of the portlet lifecycle into the RENDER_PHASE of the portlet lifecycle during a portlet mode change. This functionality is implemented in Liferay Faces Bridge with the following code:
{code:java|title=BridgeRequestScopeImpl.java}
if (!portletMode.equals(portletRequest.getPortletMode())) {
setPortletModeChanged(true);
restoreNonExcludedRequestAttributes = false;
}
{code}
h3. Steps to Reproduce:
1. Download and extract the [Pluto 3.0.0 Tomcat bundle|https://portals.apache.org/pluto/download.html].
2. Download the [Mojarra 2.3.0-m10 all-in-one jar|http://search.maven.org/remotecontent?filepath=org/glassfish/javax.faces/2.3.0-m10/javax.faces-2.3.0-m10.jar]:
{code:xml}
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.3.0-m10</version>
</dependency
{code}
3. Extract the jar:
{noformat}jar xf javax.faces-2.3.0-m10.jar{noformat}
4. Remove the following file:
{noformat}rm META-INF/services/javax.servlet.ServletContainerInitializer{noformat}
5. Re-zip the jar:
jar cmf META-INF/MANIFEST.MF javax.faces-2.3.0-m10-fixed.jar META-INF/ com/ javax/
6. Copy the jar to Pluto's tomcat/lib folder
7. Copy the icefaces-applicant-portlet (attached) war to Pluto's tomcat/webapps folder
Note: The icefaces-applicant-portlet demo is part of the Liferay Faces suite of demo portlets. Its purpose is to exercise several typical use-cases of ICEfaces in a portlet environment.
8. Start Pluto's Tomcat
9. Visit the following URL:
http://localhost:8080/pluto/portal
10. Using the Pluto Admin page, create a new page named "icefaces" and add the portlet named "1" from the com.liferay.faces.demo.icefaces.applicant.portlet module.
11. Visit the following URL:
http://localhost:8080/pluto/portal/icefaces
12. Click on the "Edit" link under the "Liferay" logo in the upper right hand corner.
13. Click the Submit button
(/) Expected Results
The portletViewMode.xhtml view is rendered correctly.
(x) Actual Results
{noformat}
java.lang.NullPointerException
at org.icefaces.impl.event.BridgeSetup.getBodyResources(BridgeSetup.java:205)
at org.icefaces.impl.event.BridgeSetup.processEvent(BridgeSetup.java:99)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:147)
at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:134)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2256)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2229)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:313)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:257)
at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:746)
at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:746)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:884)
at javax.faces.component.UIViewRoot.encodeBegin(UIViewRoot.java:1090)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1903)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:491)
at javax.faces.view.ViewDeclarationLanguageWrapper.renderView(ViewDeclarationLanguageWrapper.java:126)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:194)
at com.liferay.faces.bridge.application.internal.ViewHandlerCompatImpl.renderView(ViewHandlerCompatImpl.java:95)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:126)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
at com.liferay.faces.bridge.internal.BridgePhaseHeaderRenderCommon.executeRender(BridgePhaseHeaderRenderCommon.java:191)
at com.liferay.faces.bridge.internal.BridgePhaseHeaderImpl.execute(BridgePhaseHeaderImpl.java:67)
at com.liferay.faces.bridge.internal.BridgeCompatImpl.doFacesRequest(BridgeCompatImpl.java:52)
at javax.portlet.faces.GenericFacesPortlet.renderHeaders(GenericFacesPortlet.java:535)
{noformat}
h3. Problem Description:
The BridgeSetup.java and BridgeFormsSetup.java classes assume that the "org.icefaces.impl.event::ViewState" attribute will always be be non-null. Because of this assumption, NullPointerException is being thrown in a portlet environment during a portlet mode change. This is because of a requirement in JSR 329/378 that prevents "non excluded" request attributes from surviving from the ACTION_PHASE of the portlet lifecycle into the RENDER_PHASE of the portlet lifecycle during a portlet mode change. This functionality is implemented in Liferay Faces Bridge with the following code:
{code:java|title=BridgeRequestScopeImpl.java}
if (!portletMode.equals(portletRequest.getPortletMode())) {
setPortletModeChanged(true);
restoreNonExcludedRequestAttributes = false;
}
{code}
h3. Steps to Reproduce:
1. Download and extract the [Pluto 3.0.0 Tomcat bundle|https://portals.apache.org/pluto/download.html].
2. Download the [Mojarra 2.3.0-m10 all-in-one jar|http://search.maven.org/remotecontent?filepath=org/glassfish/javax.faces/2.3.0-m10/javax.faces-2.3.0-m10.jar]:
{code:xml}
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.3.0-m10</version>
</dependency
{code}
3. Extract the jar:
{noformat}jar xf javax.faces-2.3.0-m10.jar{noformat}
4. Remove the following file:
{noformat}rm META-INF/services/javax.servlet.ServletContainerInitializer{noformat}
5. Re-zip the jar:
jar cmf META-INF/MANIFEST.MF javax.faces-2.3.0-m10-fixed.jar META-INF/ com/ javax/
6. Copy the jar to Pluto's tomcat/lib folder
7. Copy the icefaces-applicant-portlet (attached) war to Pluto's tomcat/webapps folder
Note: The icefaces-applicant-portlet demo is part of the Liferay Faces suite of demo portlets. Its purpose is to exercise several typical use-cases of ICEfaces in a portlet environment.
8. Start Pluto's Tomcat
9. Visit the following URL:
http://localhost:8080/pluto/portal
10. Using the Pluto Admin page, create a new page named "icefaces" and add the portlet named "1" from the com.liferay.faces.demo.icefaces.applicant.portlet module.
11. Visit the following URL:
http://localhost:8080/pluto/portal/icefaces
12. Click on the "Edit" link under the "Liferay" logo in the upper right hand corner.
13. Click the Submit button
(/) Expected Results
The portletViewMode.xhtml view is rendered correctly.
(x) Actual Results
{noformat}
java.lang.NullPointerException
at org.icefaces.impl.event.BridgeSetup.getBodyResources(BridgeSetup.java:205)
at org.icefaces.impl.event.BridgeSetup.processEvent(BridgeSetup.java:99)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:147)
at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:134)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2256)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2229)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:313)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:257)
at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:746)
at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:746)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:884)
at javax.faces.component.UIViewRoot.encodeBegin(UIViewRoot.java:1090)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1903)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:491)
at javax.faces.view.ViewDeclarationLanguageWrapper.renderView(ViewDeclarationLanguageWrapper.java:126)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:194)
at com.liferay.faces.bridge.application.internal.ViewHandlerCompatImpl.renderView(ViewHandlerCompatImpl.java:95)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:126)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
at com.liferay.faces.bridge.internal.BridgePhaseHeaderRenderCommon.executeRender(BridgePhaseHeaderRenderCommon.java:191)
at com.liferay.faces.bridge.internal.BridgePhaseHeaderImpl.execute(BridgePhaseHeaderImpl.java:67)
at com.liferay.faces.bridge.internal.BridgeCompatImpl.doFacesRequest(BridgeCompatImpl.java:52)
at javax.portlet.faces.GenericFacesPortlet.renderHeaders(GenericFacesPortlet.java:535)
{noformat}
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Neil Griffin
created issue -
Neil Griffin
made changes -
Field | Original Value | New Value |
---|---|---|
Attachment | com.liferay.faces.demo.icefaces.applicant.portlet-6.0.0-SNAPSHOT.war [ 22460 ] |
Ken Fyten
made changes -
Fix Version/s | EE-4.2.0.GA [ 13071 ] |
Ken Fyten
made changes -
Fix Version/s | 4.3 [ 13096 ] | |
Fix Version/s | EE-4.2.0.GA [ 13071 ] |
Ken Fyten
made changes -
Assignee | Mircea Toma [ mircea.toma ] | |
Assignee Priority | P2 [ 10011 ] |
Mircea Toma
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |