You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2024/01/05 13:34:41 UTC

(httpcomponents-client) branch master updated: HTTPCLIENT-2314: Throw ConnectionShutdownException in case of pooled connection having been closed or discarded instead of plain IllegalStateException

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/master by this push:
     new e2385f7d9 HTTPCLIENT-2314: Throw ConnectionShutdownException in case of pooled connection having been closed or discarded instead of plain IllegalStateException
e2385f7d9 is described below

commit e2385f7d9a7994b3359b224d5454b18ec2b1fc0a
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Jan 5 14:28:44 2024 +0100

    HTTPCLIENT-2314: Throw ConnectionShutdownException in case of pooled connection having been closed or discarded instead of plain IllegalStateException
---
 .../hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
index 4960d6afe..73fa29d8e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
@@ -76,7 +76,6 @@ import org.apache.hc.core5.pool.PoolReusePolicy;
 import org.apache.hc.core5.pool.PoolStats;
 import org.apache.hc.core5.pool.StrictConnPool;
 import org.apache.hc.core5.util.Args;
-import org.apache.hc.core5.util.Asserts;
 import org.apache.hc.core5.util.Deadline;
 import org.apache.hc.core5.util.Identifiable;
 import org.apache.hc.core5.util.TimeValue;
@@ -673,7 +672,9 @@ public class PoolingHttpClientConnectionManager
         PoolEntry<HttpRoute, ManagedHttpClientConnection> getValidatedPoolEntry() {
             final PoolEntry<HttpRoute, ManagedHttpClientConnection> poolEntry = getPoolEntry();
             final ManagedHttpClientConnection connection = poolEntry.getConnection();
-            Asserts.check(connection != null && connection.isOpen(), "Endpoint is not connected");
+            if (connection == null || !connection.isOpen()) {
+                throw new ConnectionShutdownException();
+            }
             return poolEntry;
         }