From 939d4b23208a07853aa114766101dd6def7183d7 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sun, 2 Jun 2024 11:14:58 +0200 Subject: [PATCH] Bug fix: corrected exception type thrown in case of unexpected connection termination --- .../hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java index b60adf2dcc..90684952fb 100644 --- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java +++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java @@ -30,7 +30,6 @@ import java.io.IOException; import java.net.SocketAddress; import java.nio.ByteBuffer; -import java.nio.channels.ClosedChannelException; import java.nio.channels.ReadableByteChannel; import java.nio.channels.SelectionKey; import java.nio.channels.WritableByteChannel; @@ -498,7 +497,7 @@ int streamOutput(final ByteBuffer src) throws IOException { ioSession.getLock().lock(); try { if (outgoingMessage == null) { - throw new ClosedChannelException(); + throw new ConnectionClosedException(); } final ContentEncoder contentEncoder = outgoingMessage.getBody(); final int bytesWritten = contentEncoder.write(src);