Permalink
Browse files

UNDERTOW-577 UT010019: Response already commited when servlet form au…

…th page is missing
  • Loading branch information...
1 parent 80f68de commit 6e9663576fcaaa14f5a9cedf4ae1a144b20fd09e @stuartwdouglas stuartwdouglas committed Nov 5, 2015
Showing with 4 additions and 1 deletion.
  1. +4 −1 servlet/src/main/java/io/undertow/servlet/spec/HttpServletResponseImpl.java
@@ -120,7 +120,11 @@ public void sendError(final int sc, final String msg) throws IOException {
//not 100% sure this is the correct action
return;
}
+ ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
if (responseStarted()) {
+ if(src.getErrorCode() > 0) {
+ return; //error already set
+ }
throw UndertowServletMessages.MESSAGES.responseAlreadyCommited();
}
if(servletContext.getDeployment().getDeploymentInfo().isSendCustomReasonPhraseOnError()) {
@@ -129,7 +133,6 @@ public void sendError(final int sc, final String msg) throws IOException {
writer = null;
responseState = ResponseState.NONE;
exchange.setStatusCode(sc);
- ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
if(src.isRunningInsideHandler()) {
//all we do is set the error on the context, we handle it when the request is returned
treatAsCommitted = true;

0 comments on commit 6e96635

Please sign in to comment.