ICEfaces
  1. ICEfaces
  2. ICE-5595

ICEfaces 2.0 BridgeSetup StateManagerStrategyImpl ClassCastException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2.0

      Description


      The following exception appears immediately on postback from a clean checkout and build of auction:

      java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map
      at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:212)
      at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
      at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:430)
      at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:619)

      It appears to be due to state management side effects in BridgeSetup.java.

        Activity

        Hide
        Mircea Toma added a comment - - edited

        It seems that state saved when BridgeSetup invokes StateManager.getViewState is of different type than the one expected when restore phase is executed, hence the ClassCastException.
        The exact place where state saving type is configured is here:
        com.sun.faces.application.view.FaceletViewHandlingStrategy.updateStateSavingType(FaceletViewHandlingStrategy.java:1,020)
        at
        com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:699)
        at
        com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

        FaceletViewHandlingStrategy.updateStateSavingType will set the the attribute "partialStateSaving" to true after BridgeSetup invokes StateManager.getViewState. Subsequent restore phase executions will expect the state save in the format corresponding to partial state saving strategy.

        Show
        Mircea Toma added a comment - - edited It seems that state saved when BridgeSetup invokes StateManager.getViewState is of different type than the one expected when restore phase is executed, hence the ClassCastException. The exact place where state saving type is configured is here: com.sun.faces.application.view.FaceletViewHandlingStrategy.updateStateSavingType(FaceletViewHandlingStrategy.java:1,020) at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:699) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313) FaceletViewHandlingStrategy.updateStateSavingType will set the the attribute "partialStateSaving" to true after BridgeSetup invokes StateManager.getViewState. Subsequent restore phase executions will expect the state save in the format corresponding to partial state saving strategy.
        Hide
        Mircea Toma added a comment -

        Moving the BridgeSetup code from a phase listener into a system event listener that listens for PreRenderViewEvent event seems to solve the issue since PreRenderViewEvent is fired after partial state saving is configured as state saving strategy.

        Show
        Mircea Toma added a comment - Moving the BridgeSetup code from a phase listener into a system event listener that listens for PreRenderViewEvent event seems to solve the issue since PreRenderViewEvent is fired after partial state saving is configured as state saving strategy.
        Hide
        Mircea Toma added a comment - - edited

        Changed BridgeSetup into a system event listener to avoid invoking StateManager.getViewState before state management strategy is chosen by JSF.

        Show
        Mircea Toma added a comment - - edited Changed BridgeSetup into a system event listener to avoid invoking StateManager.getViewState before state management strategy is chosen by JSF.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: