Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-2873

The showcase portlets do not provide an overridden-parameter value for the _facesViewId parameter

    Details

      Description

      Problem Background

      The problem manifested itself in the alloy-showcase-portlet after FACES-2654 was implemented, which gave Liferay Faces Bridge the ability to support Liferay Portal "friendly" URLs for ActionURL and ResourceURL. Prior to that, only RenderURL was supported.

      Note: When the friendly URL mapper is disabled, then the problem is no longer reproducible. It can be disabled by removing the following lines are removed from the WEB-INF/liferay-portlet.xml descriptor:

       
      <friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class> 
      <friendly-url-mapping>alloy-tag</friendly-url-mapping> 
      <friendly-url-routes>friendly-url-routes.xml</friendly-url-routes> 
      

      Problem Solution

      The solution to the problem is to add the following to the friendly-url-routes.xml descriptor:

      <overridden-parameter name="_facesViewIdRender">/views/component.xhtml</overridden-parameter>
      

      Steps to Reproduce

      1. Modify the source of alloy-showcase-webapp/src/main/webapp/WEB-INF/component/alloy/inputfile/multiple/inputFile.xhtml and change this line:

       
      <alloy:form enctype="multipart/form-data"> 
      

      to this:

       
      <alloy:form enctype="multipart/form-data" includeViewParams="true"> 
      

      2. Deploy the portlet to either Liferay Portal 6.2 or 7.0

      3. Navigate to the portal page for the alloy:inputFile "multiple" use-case

      4. Click on the "Choose Files" button and select a file to upload

      5. Click on the Submit button

      Expected Results:

      The file is uploaded and appears in the list of uploaded files. Additionally, it will be possible to click on the trash can icon in order to delete the uploaded file.

      Actual Results:

      The portlet displays "Internal Server Error" and the following error appears in the server log:

       
      SEVERE: Servlet.service() for servlet 1 Servlet threw exception 
      javax.portlet.faces.BridgeException: javax.faces.FacesException: Index: 0, Size: 0 
      at com.liferay.faces.bridge.internal.BridgePhaseActionImpl.execute(BridgePhaseActionImpl.java:153) 
      at com.liferay.faces.bridge.internal.BridgeImpl.doFacesRequest(BridgeImpl.java:93) 
      at javax.portlet.faces.GenericFacesPortlet.processAction(GenericFacesPortlet.java:501) 
      [...] 
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
      at java.lang.Thread.run(Thread.java:744) 
      Caused by: javax.faces.FacesException: Index: 0, Size: 0 
      at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:141) 
      at javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:100) 
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) 
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123) 
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) 
      at com.liferay.faces.bridge.internal.BridgePhaseActionImpl.execute(BridgePhaseActionImpl.java:110) 
      ... 157 more 
      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 
      at java.util.ArrayList.rangeCheck(ArrayList.java:635) 
      at java.util.ArrayList.get(ArrayList.java:411) 
      at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:166) 
      at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1612) 
      at javax.faces.component.UIOutput.restoreState(UIOutput.java:286) 
      at com.sun.faces.application.view.FaceletPartialStateManagementStrategy$2.visit(FaceletPartialStateManagementStrategy.java:379) 
      at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151) 
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689) 
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) 
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) 
      at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:366)
      at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138) 
      at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123) 
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:591) 
      at javax.faces.view.ViewDeclarationLanguageWrapper.restoreView(ViewDeclarationLanguageWrapper.java:151) 
      at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:151) 
      at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:353) 
      at com.liferay.faces.bridge.application.internal.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:129) 
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199) 
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
      ... 160 more 
      

        Attachments

          Activity

            People

            • Assignee:
              neil.griffin Neil Griffin
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                bridge-impl-3.0.0
                bridge-impl-4.0.0