Issue #2970 ensure onComplete is called (#2971)

* Issue #2970 ensure onComplete is called
* Cleanup after review - single try

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-10-20 10:15:05 +11:00 committed by GitHub
parent edc47818e2
commit efdf3c2473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 20 deletions

View File

@ -480,6 +480,8 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
} }
case COMPLETE: case COMPLETE:
{
try
{ {
if (!_response.isCommitted() && !_request.isHandled()) if (!_response.isCommitted() && !_request.isHandled())
{ {
@ -499,15 +501,18 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
if (isCommitted()) if (isCommitted())
abort(new IOException("insufficient content written")); abort(new IOException("insufficient content written"));
else else
_response.sendError(HttpStatus.INTERNAL_SERVER_ERROR_500,"insufficient content written"); _response.sendError(HttpStatus.INTERNAL_SERVER_ERROR_500, "insufficient content written");
} }
} }
_response.closeOutput(); _response.closeOutput();
}
finally
{
_request.setHandled(true); _request.setHandled(true);
_state.onComplete(); _state.onComplete();
onCompleted(); onCompleted();
}
break loop; break loop;
} }