hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r989309 - /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
Date Wed, 25 Aug 2010 19:14:23 GMT
Author: olegk
Date: Wed Aug 25 19:14:22 2010
New Revision: 989309

URL: http://svn.apache.org/viewvc?rev=989309&view=rev
Log:
Always propagate the original I/O exception thrown when executing the request and ignore those
thrown by connection close

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java?rev=989309&r1=989308&r2=989309&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
Wed Aug 25 19:14:22 2010
@@ -126,17 +126,24 @@ public class HttpRequestExecutor {
             }
             return response;
         } catch (IOException ex) {
-            conn.close();
+            closeConnection(conn);
             throw ex;
         } catch (HttpException ex) {
-            conn.close();
+            closeConnection(conn);
             throw ex;
         } catch (RuntimeException ex) {
-            conn.close();
+            closeConnection(conn);
             throw ex;
         }
     }
 
+    private final static void closeConnection(final HttpClientConnection conn) {
+        try {
+            conn.close();
+        } catch (IOException ignore) {
+        }
+    }
+
     /**
      * Pre-process the given request using the given protocol processor and
      * initiates the process of request execution.



Mime
View raw message