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 2010/12/29 18:05:04 UTC
svn commit: r1053675 -
/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Author: olegk
Date: Wed Dec 29 17:05:04 2010
New Revision: 1053675
URL: http://svn.apache.org/viewvc?rev=1053675&view=rev
Log:
Removed calls to deprecated methods
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=1053675&r1=1053674&r2=1053675&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java Wed Dec 29 17:05:04 2010
@@ -68,6 +68,7 @@ import org.apache.http.protocol.HttpCont
import org.apache.http.protocol.HttpProcessor;
import org.apache.http.protocol.HttpRequestExecutor;
import org.apache.http.protocol.ImmutableHttpProcessor;
+import org.apache.http.util.EntityUtils;
/**
* Base class for {@link HttpClient} implementations. This class acts as
@@ -845,14 +846,12 @@ public abstract class AbstractHttpClient
result = responseHandler.handleResponse(response);
} catch (Throwable t) {
HttpEntity entity = response.getEntity();
- if (entity != null) {
- try {
- entity.consumeContent();
- } catch (Exception t2) {
- // Log this exception. The original exception is more
- // important and will be thrown to the caller.
- this.log.warn("Error consuming content after an exception.", t2);
- }
+ try {
+ EntityUtils.consume(entity);
+ } catch (Exception t2) {
+ // Log this exception. The original exception is more
+ // important and will be thrown to the caller.
+ this.log.warn("Error consuming content after an exception.", t2);
}
if (t instanceof Error) {
@@ -873,11 +872,7 @@ public abstract class AbstractHttpClient
// Handling the response was successful. Ensure that the content has
// been fully consumed.
HttpEntity entity = response.getEntity();
- if (entity != null) {
- // Let this exception go to the caller.
- entity.consumeContent();
- }
-
+ EntityUtils.consume(entity);
return result;
}