hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1685255 - /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
Date Sat, 13 Jun 2015 13:43:10 GMT
Author: olegk
Date: Sat Jun 13 13:43:10 2015
New Revision: 1685255

URL: http://svn.apache.org/r1685255
Log:
Throw ConnectionClosedException instead of IllegalStateException if connection is closed (not
bound to a socket)

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java?rev=1685255&r1=1685254&r2=1685255&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
Sat Jun 13 13:43:10 2015
@@ -39,6 +39,7 @@ import java.nio.charset.CharsetEncoder;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.http.BHttpConnection;
+import org.apache.http.ConnectionClosedException;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
@@ -59,7 +60,6 @@ import org.apache.http.impl.io.SessionOu
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.util.Args;
-import org.apache.http.util.Asserts;
 import org.apache.http.util.NetUtils;
 
 class BHttpConnectionBase implements BHttpConnection {
@@ -91,7 +91,9 @@ class BHttpConnectionBase implements BHt
 
     protected void ensureOpen() throws IOException {
         final Socket socket = this.socketHolder.get();
-        Asserts.check(socket != null, "Connection is not open");
+        if (socket == null) {
+            throw new ConnectionClosedException("Connection is closed");
+        }
         if (!this.inbuffer.isBound()) {
             this.inbuffer.bind(getSocketInputStream(socket));
         }



Mime
View raw message