Removed calls to deprecated methods

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1053675 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2010-12-29 17:05:04 +00:00
parent eda06a75ee
commit 21aae1dfe2
1 changed files with 8 additions and 13 deletions

View File

@ -68,6 +68,7 @@ import org.apache.http.protocol.HttpContext;
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,15 +846,13 @@ public abstract class AbstractHttpClient implements HttpClient {
result = responseHandler.handleResponse(response);
} catch (Throwable t) {
HttpEntity entity = response.getEntity();
if (entity != null) {
try {
entity.consumeContent();
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) {
throw (Error) t;
@ -873,11 +872,7 @@ public abstract class AbstractHttpClient implements HttpClient {
// 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;
}