hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1685254 - /httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
Date Sat, 13 Jun 2015 13:41:07 GMT
Author: olegk
Date: Sat Jun 13 13:41:06 2015
New Revision: 1685254

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

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java?rev=1685254&r1=1685253&r2=1685254&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
Sat Jun 13 13:41:06 2015
@@ -39,6 +39,7 @@ import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.apache.http.ConnectionClosedException;
 import org.apache.http.Header;
 import org.apache.http.HttpConnection;
 import org.apache.http.HttpConnectionMetrics;
@@ -66,7 +67,6 @@ import org.apache.http.io.SessionInputBu
 import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
-import org.apache.http.util.Asserts;
 import org.apache.http.util.NetUtils;
 
 /**
@@ -129,7 +129,9 @@ public class BHttpConnectionBase impleme
 
     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