[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    svn commit: r1685254 - /httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/htt
From:       olegk () apache ! org
Date:       2015-06-13 13:41:07
Message-ID: 20150613134107.63187AC0373 () hades ! apache ! org
[Download RAW message or body]

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));
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic