diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/util/InputStreamResponseListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/util/InputStreamResponseListener.java index e0d57203b40..cc6547f33a6 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/util/InputStreamResponseListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/util/InputStreamResponseListener.java @@ -359,8 +359,11 @@ public class InputStreamResponseListener extends Listener.Adapter if (LOG.isDebugEnabled()) LOG.debug("InputStream close"); - Throwable failure = new AsynchronousCloseException(); - callbacks.forEach(callback -> callback.failed(failure)); + if (!callbacks.isEmpty()) + { + Throwable failure = new AsynchronousCloseException(); + callbacks.forEach(callback -> callback.failed(failure)); + } super.close(); }