hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r989343 - /httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
Date Wed, 25 Aug 2010 20:23:38 GMT
Author: olegk
Date: Wed Aug 25 20:23:38 2010
New Revision: 989343

URL: http://svn.apache.org/viewvc?rev=989343&view=rev
Log:
Catch and log I/O exceptions thrown by #close() and #shutdown() methods

Modified:
    httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java

Modified: httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java?rev=989343&r1=989342&r2=989343&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
(original)
+++ httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
Wed Aug 25 20:23:38 2010
@@ -138,20 +138,26 @@ public class DefaultClientConnection ext
      */
     @Override
     public void shutdown() throws IOException {
-        log.debug("Connection shut down");
         shutdown = true;
-        
-        super.shutdown();        
-        Socket sock = this.socket; // copy volatile attribute
-        if (sock != null)
-            sock.close();
-
+        try {
+            super.shutdown();
+            log.debug("Connection shut down");
+            Socket sock = this.socket; // copy volatile attribute
+            if (sock != null)
+                sock.close();
+        } catch (IOException ex) {
+            log.debug("I/O error shutting down connection", ex);
+        }
     }
-    
+
     @Override
     public void close() throws IOException {
-        log.debug("Connection closed");
-        super.close();
+        try {
+            super.close();
+            log.debug("Connection closed");
+        } catch (IOException ex) {
+            log.debug("I/O error closing connection", ex);
+        }
     }
 
     @Override



Mime
View raw message