Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.0, 2.0.1, 2.0.2, 3.0, 3.0.1
-
Fix Version/s: 3.1.0.BETA1, 3.1
-
Component/s: ACE-Components
-
Labels:None
-
Environment:Portlet Environment
-
Assignee Priority:P2
-
Workaround Exists:Yes
-
Workaround Description:
Description
Recently I fixed a TCK failure in Liferay Faces Bridge regarding ExternalContext.getRequestContentType():
http://issues.liferay.com/browse/FACES-1226
The method used to return "text/html" but with the FACES-1226 it returns "multipart/form-data; ..." and this is changing the behavior of the following method in FileEntryResourceHandler:
{code}
@Override
public boolean isResourceRequest(FacesContext facesContext) {
ExternalContext externalContext = facesContext.getExternalContext();
String reqContentType = externalContext.getRequestContentType();
if ( (null == reqContentType) ||
!reqContentType.startsWith("multipart") ) {
return wrapped.isResourceRequest(facesContext);
}
{code}
Because of this, ace:fileEntry is causing the following stacktrace:
21:05:14,993 ERROR [ExceptionHandlerAjaxImpl:57]
java.lang.NullPointerException
at org.icefaces.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(ServletFileUpload.java:68)
at org.icefaces.ace.component.fileentry.FileEntryPhaseListener.beforePhase(FileEntryPhaseListener.java:114)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:109)
http://issues.liferay.com/browse/FACES-1226
The method used to return "text/html" but with the FACES-1226 it returns "multipart/form-data; ..." and this is changing the behavior of the following method in FileEntryResourceHandler:
{code}
@Override
public boolean isResourceRequest(FacesContext facesContext) {
ExternalContext externalContext = facesContext.getExternalContext();
String reqContentType = externalContext.getRequestContentType();
if ( (null == reqContentType) ||
!reqContentType.startsWith("multipart") ) {
return wrapped.isResourceRequest(facesContext);
}
{code}
Because of this, ace:fileEntry is causing the following stacktrace:
21:05:14,993 ERROR [ExceptionHandlerAjaxImpl:57]
java.lang.NullPointerException
at org.icefaces.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(ServletFileUpload.java:68)
at org.icefaces.ace.component.fileentry.FileEntryPhaseListener.beforePhase(FileEntryPhaseListener.java:114)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:109)
Checked in an update to ServletFileUpload.isMultipartContent to check if the getMethod returns a null value. As per
ICE-6371, the getMethod() call doesn't exist in the ExternalContext API and is only available on a subset of the various types of requests that portlets can provide. This won't affect PortletFaces Bridge and will allow Liferay Faces Bridge to work without requiring the special handling for ICEfaces.