From 5ac57c13e013e62105ef7f0e86a29a420fb8cf2e Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 12 Jun 2023 19:08:35 +0200 Subject: [PATCH] Fixed ErrorResponseAndCallback succeeded() and failed() to call super.failed() in all cases to complete the wrapped callback. Signed-off-by: Simone Bordet --- .../jetty/server/internal/HttpChannelState.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java index 1a770e745e66..ae666b8a6b40 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java @@ -288,7 +288,6 @@ public Runnable onRequest(MetaData.Request request) if (idleTO >= 0 && _oldIdleTimeout != idleTO) _stream.setIdleTimeout(idleTO); - // This is deliberately not serialized to allow a handler to block. return _handlerInvoker; } @@ -1571,7 +1570,7 @@ public ErrorResponseAndCallback(ChannelRequest request, HttpStream stream, Throw _request = request; _stream = stream; _failure = failure; - _status = 500; + _status = HttpStatus.INTERNAL_SERVER_ERROR_500; } @Override @@ -1623,17 +1622,17 @@ public void succeeded() if (needLastWrite) { _stream.send(_request._metaData, responseMetaData, true, null, - Callback.from(() -> httpChannelState._handlerInvoker.failed(failure), + Callback.from(() -> super.failed(failure), x -> { if (ExceptionUtil.areNotAssociated(failure, x)) failure.addSuppressed(x); - httpChannelState._handlerInvoker.failed(failure); + super.failed(failure); })); } else { - httpChannelState._handlerInvoker.failed(failure); + super.failed(failure); } } @@ -1667,13 +1666,7 @@ public void failed(Throwable x) } if (ExceptionUtil.areNotAssociated(failure, x)) failure.addSuppressed(x); - httpChannelState._handlerInvoker.failed(failure); - } - - @Override - public String toString() - { - return "%s@%x".formatted(getClass().getSimpleName(), hashCode()); + super.failed(failure); } }