Merge pull request #4278 from eclipse/jetty-9.4.x-4264-revert-doError-signature

Issue #4264 Revert doError signature
This commit is contained in:
Joakim Erdfelt 2019-11-07 09:36:54 -06:00 committed by GitHub
commit 6151892155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 11 deletions

View File

@ -27,11 +27,9 @@ import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@ -95,7 +93,7 @@ public class ErrorHandler extends AbstractHandler
}
@Override
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
{
String cacheControl = getCacheControl();
if (cacheControl != null)
@ -113,15 +111,23 @@ public class ErrorHandler extends AbstractHandler
{
if (errorDispatcher != null)
{
errorDispatcher.error(request, response);
}
else
{
String message = (String)request.getAttribute(Dispatcher.ERROR_MESSAGE);
if (message == null)
message = baseRequest.getResponse().getReason();
generateAcceptableResponse(baseRequest, request, response, response.getStatus(), message);
try
{
errorDispatcher.error(request, response);
return;
}
catch (ServletException e)
{
LOG.debug(e);
if (response.isCommitted())
return;
}
}
String message = (String)request.getAttribute(Dispatcher.ERROR_MESSAGE);
if (message == null)
message = baseRequest.getResponse().getReason();
generateAcceptableResponse(baseRequest, request, response, response.getStatus(), message);
}
finally
{