myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Rossi (Created) (JIRA)" <>
Subject [jira] [Created] (MYFACES-3354) NullPointerException on jetty 6.1.5 with faces-redirect=true action result
Date Tue, 11 Oct 2011 19:55:12 GMT
NullPointerException on jetty 6.1.5 with faces-redirect=true action result

                 Key: MYFACES-3354
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions: 2.0.9
         Environment: Ubuntu 11, jetty 6.1.5, MyFaces Core 2.0.9, Primefaces 3.0M3
            Reporter: Joe Rossi
            Priority: Minor

XHTML file:

      <p:commandButton id="saveAndGo"
        value="Save and Go"

Backing Bean method:

  public String saveAction()
    throws Exception
      ProcessInstance process = _createProcessInstance();
      return "/home/assistants/assistant?faces-redirect=true&processInstanceId="
            + process.getId();

Invoking the command button produces the following stack trace, causing part of the next page
to terminate rendering:

	at org.mortbay.jetty.NCSARequestLog.log(
	at org.mortbay.jetty.handler.RequestLogHandler.handle(
	at org.mortbay.jetty.handler.ContextHandler.handle(
	at org.mortbay.jetty.webapp.WebAppContext.handle(
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
	at org.mortbay.jetty.handler.HandlerCollection.handle(
	at org.mortbay.jetty.handler.HandlerWrapper.handle(
	at org.mortbay.jetty.Server.handle(
	at org.mortbay.jetty.HttpConnection.handleRequest(
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(
	at org.mortbay.jetty.HttpParser.parseNext(
	at org.mortbay.jetty.HttpParser.parseAvailable(
	at org.mortbay.jetty.HttpConnection.handle(
	at org.mortbay.thread.BoundedThreadPool$

The section of jetty code that throws the NullPointerException is as follows (offending line

                if (_logCookies)
                    Cookie[] cookies = request.getCookies();
                    if (cookies == null || cookies.length == 0)
                        _writer.write(" -");
                        _writer.write(" \"");
                        for (int i = 0; i < cookies.length; i++)
                            if (i != 0)
                            _writer.write(cookies[i].getValue());  // <<-- NullPointerException

Caused because the cookie oam.Flash.REDIRECT has a null value.

Looking at the source code for Myfaces Core - org.apache.myfaces.shared.context.flash.FlashImpl,
the function _restoreRedirectValue has the following code which is used to remove the cookie:

            if (cookie != null)
                // the cookie exists means there was a redirect, regardless of the value
                        FLASH_PREVIOUS_REQUEST_REDIRECT, Boolean.TRUE);
                // A redirect happened, so it is safe to remove the cookie, setting
                // the maxAge to 0 seconds. The effect is we passed FLASH_REDIRECT param 
                // to this request object

My understanding is that a cookie can be removed by setMaxAge(0). Hence the setValue(null)
is redundant. Removing this should fix the issue.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message