diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java index 6bac7730f51..5a929d57cef 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java @@ -367,8 +367,15 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor if (LOG.isDebugEnabled()) LOG.debug("Could not perform ERROR dispatch, aborting", x); Throwable failure = (Throwable)_request.getAttribute(RequestDispatcher.ERROR_EXCEPTION); - failure.addSuppressed(x); - minimalErrorResponse(failure); + if (failure==null) + { + minimalErrorResponse(x); + } + else + { + failure.addSuppressed(x); + minimalErrorResponse(failure); + } } break; } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index 46823260f24..3f9940c8e89 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -654,7 +654,8 @@ public class Response implements HttpServletResponse if (error_handler!=null) error_handler.handle(null, request, request, this); } - closeOutput(); + if (!request.isAsyncStarted()) + closeOutput(); } /** diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java index 42825f5ce6e..c4127173a6a 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java @@ -52,7 +52,6 @@ import javax.servlet.http.HttpServletResponseWrapper; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.DebugListener; -import org.eclipse.jetty.server.Dispatcher; import org.eclipse.jetty.server.HttpChannel; import org.eclipse.jetty.server.QuietServletException; import org.eclipse.jetty.server.Request; @@ -753,7 +752,6 @@ public class AsyncServletTest // ignored } - // System.err.println(request.getDispatcherType()+" "+request.getRequestURI()); historyAdd(request.getDispatcherType()+" "+request.getRequestURI()); if (request instanceof ServletRequestWrapper || response instanceof ServletResponseWrapper) historyAdd("wrapped"+((request instanceof ServletRequestWrapper)?" REQ":"")+((response instanceof ServletResponseWrapper)?" RSP":""));