Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3673

NullPointerException in FlashImpl when forwarding from an init action

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.0.16
    • None
    • JSR-314
    • None
    • Windows Myfaces 2.0.16, Jetty 8.1.3.v20120416

    Description

      Hi,

      the following exception occurs when ich try to forward from an init action the preRenderView phase:
      The xhtml page i call contains the following preRenderView listener:

      <f:metadata>
      <f:event type="preRenderView" listener="#

      {localizedInitializerView.init}

      " />
      </f:metadata>

      In the init Method of the listener i am performing a forward to a different page with the following
      logic:

      public void init() throws Exception

      { // performs the forward HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); RequestDispatcher dispatcher = request.getRequestDispatcher("localized.jsf"); dispatcher.forward(request, response); // FacesContext.getCurrentInstance().getExternalContext().redirect("localized.jsf"); FacesContext.getCurrentInstance().responseComplete(); }

      The result is strange, because the forward just works fine, however i am always getting the following
      NullPointerException in the log file. Using a redirect instead of the forward just works fine.

      java.lang.NullPointerException
      at org.apache.myfaces.shared.context.flash.FlashImpl.isKeepMessages(FlashImpl.java:389)
      at org.apache.myfaces.shared.context.flash.FlashImpl._saveMessages(FlashImpl.java:666)
      at org.apache.myfaces.shared.context.flash.FlashImpl.doPostPhaseActions(FlashImpl.java:270)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:251)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
      at org.eclipse.jetty.server.Server.handle(Server.java:350)
      at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
      at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
      at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
      at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
      at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)

      If you need more information about the problem or a testcase, please tell me.

      Cheers,
      Andy

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            kickmetondy Andreas Wuest
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: