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/06/16 21:42:15 UTC
svn commit: r1350987 -
/httpcomponents/httpclient/branches/decorator-refactoring/httpclient/src/main/java/org/apache/http/impl/client/exec/RedirectFacade.java
Author: olegk
Date: Sat Jun 16 19:42:15 2012
New Revision: 1350987
URL: http://svn.apache.org/viewvc?rev=1350987&view=rev
Log:
Preserve original HTTP exception in case an attempt to consume response content results in an I/O exception
Modified:
httpcomponents/httpclient/branches/decorator-refactoring/httpclient/src/main/java/org/apache/http/impl/client/exec/RedirectFacade.java
Modified: httpcomponents/httpclient/branches/decorator-refactoring/httpclient/src/main/java/org/apache/http/impl/client/exec/RedirectFacade.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/decorator-refactoring/httpclient/src/main/java/org/apache/http/impl/client/exec/RedirectFacade.java?rev=1350987&r1=1350986&r2=1350987&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/decorator-refactoring/httpclient/src/main/java/org/apache/http/impl/client/exec/RedirectFacade.java (original)
+++ httpcomponents/httpclient/branches/decorator-refactoring/httpclient/src/main/java/org/apache/http/impl/client/exec/RedirectFacade.java Sat Jun 16 19:42:15 2012
@@ -32,7 +32,6 @@ import java.net.URI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -160,17 +159,15 @@ public class RedirectFacade implements H
if (this.log.isDebugEnabled()) {
this.log.debug("Redirecting to '" + uri + "' via " + currentRoute);
}
- HttpEntity entity = response.getEntity();
- if (entity != null) {
- EntityUtils.consume(entity);
- }
+ EntityUtils.consume(response.getEntity());
} else {
return response;
}
} catch (HttpException ex) {
- HttpEntity entity = response.getEntity();
- if (entity != null) {
- EntityUtils.consume(entity);
+ try {
+ EntityUtils.consume(response.getEntity());
+ } catch (IOException ioex) {
+ this.log.warn(ex.getMessage(), ioex);
}
throw ex;
}