Skip to content

Commit 67519a1

Browse files
committed
HTTPCLIENT-2314: Throw ConnectionShutdownException in case of pooled connection having been closed or discarded instead of plain IllegalStateException
1 parent 7d853d5 commit 67519a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
import org.apache.hc.core5.pool.PoolStats;
7676
import org.apache.hc.core5.pool.StrictConnPool;
7777
import org.apache.hc.core5.util.Args;
78-
import org.apache.hc.core5.util.Asserts;
7978
import org.apache.hc.core5.util.Deadline;
8079
import org.apache.hc.core5.util.Identifiable;
8180
import org.apache.hc.core5.util.TimeValue;
@@ -665,7 +664,9 @@ PoolEntry<HttpRoute, ManagedHttpClientConnection> getPoolEntry() {
665664
PoolEntry<HttpRoute, ManagedHttpClientConnection> getValidatedPoolEntry() {
666665
final PoolEntry<HttpRoute, ManagedHttpClientConnection> poolEntry = getPoolEntry();
667666
final ManagedHttpClientConnection connection = poolEntry.getConnection();
668-
Asserts.check(connection != null && connection.isOpen(), "Endpoint is not connected");
667+
if (connection == null || !connection.isOpen()) {
668+
throw new ConnectionShutdownException();
669+
}
669670
return poolEntry;
670671
}
671672

0 commit comments

Comments
 (0)