Spring Web Flow
  1. Spring Web Flow
  2. SWF-1461

NPE in FlowViewStateManager.saveView when not a flow request

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Complete
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.3.1
    • Component/s: JSF
    • Labels:
      None

      Description

      When rendering a JSF view that is not part of flow request a NullPointerException is thrown:

      java.lang.NullPointerException
      	at org.springframework.faces.webflow.FlowViewStateManager.saveView(FlowViewStateManager.java:181)
      	at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:221)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:406)
      	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
      	at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
      	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
      	at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
      	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
      	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
      	at org.springframework.springfaces.FacesView.renderMergedOutputModel(FacesView.java:39)
      	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	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:859)
      	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:662)
      

      The StateManager should probably just delegate if JsfUtils.isFlowRequest() returns false:

      if (context.getViewRoot().isTransient()) {
        return null;
      }
      if(!JsfUtils.isFlowRequest()) {
        return delegate.saveView(context);
      }
      FlowSerializedView view = null;
      if (JsfRuntimeInformation.isPartialStateSavingSupported()) {
        Object[] state = (Object[]) delegate.saveView(context);
        view = new FlowSerializedView(context.getViewRoot().getViewId(), state[0], state[1]);
      } else {
        view = new FlowSerializedView(context.getViewRoot().getViewId(), getTreeStructureToSave(context),
      				getComponentStateToSave(context));
      }
      ...
      

        Activity

        Hide
        Simon Roy added a comment -

        Is there a nightly or development build on this which i can download and test?

        Show
        Simon Roy added a comment - Is there a nightly or development build on this which i can download and test?
        Hide
        Rossen Stoyanchev added a comment -

        via Maven:

        <repository>
           <id>org.springframework.maven.snapshot</id>
           <name>Spring Maven Snapshot Repository</name>
           <url>http://maven.springframework.org/snapshot</url>
        </repository>
        

        Or to browse:

        http://s3browse.springsource.com/browse/maven.springframework.org/snapshot/org/springframework/webflow/
        
        Show
        Rossen Stoyanchev added a comment - via Maven: <repository> <id> org.springframework.maven.snapshot </id> <name> Spring Maven Snapshot Repository </name> <url> http://maven.springframework.org/snapshot </url> </repository> Or to browse: http://s3browse.springsource.com/browse/maven.springframework.org/snapshot/org/springframework/webflow/

          People

          • Assignee:
            Rossen Stoyanchev
            Reporter:
            !!Use pwebb rather than philw
          • Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development