You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2012/03/31 13:16:45 UTC
svn commit: r1307766 -
/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/BasicManagedEntity.java
Author: olegk
Date: Sat Mar 31 11:16:45 2012
New Revision: 1307766
URL: http://svn.apache.org/viewvc?rev=1307766&view=rev
Log:
BasicManagedEntity#streamClosed no longer propagates SocketException if the underlying connection has been shut down
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/BasicManagedEntity.java
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/BasicManagedEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/BasicManagedEntity.java?rev=1307766&r1=1307765&r2=1307766&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/BasicManagedEntity.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/BasicManagedEntity.java Sat Mar 31 11:16:45 2012
@@ -30,6 +30,7 @@ package org.apache.http.conn;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.SocketException;
import org.apache.http.annotation.NotThreadSafe;
@@ -147,10 +148,17 @@ public class BasicManagedEntity extends
public boolean streamClosed(InputStream wrapped) throws IOException {
try {
if (attemptReuse && (managedConn != null)) {
+ boolean valid = managedConn.isOpen();
// this assumes that closing the stream will
// consume the remainder of the response body:
- wrapped.close();
- managedConn.markReusable();
+ try {
+ wrapped.close();
+ managedConn.markReusable();
+ } catch (SocketException ex) {
+ if (valid) {
+ throw ex;
+ }
+ }
}
} finally {
releaseManagedConnection();