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:
parent
eda06a75ee
commit
21aae1dfe2
|
@ -68,6 +68,7 @@ import org.apache.http.protocol.HttpContext;
|
||||||
import org.apache.http.protocol.HttpProcessor;
|
import org.apache.http.protocol.HttpProcessor;
|
||||||
import org.apache.http.protocol.HttpRequestExecutor;
|
import org.apache.http.protocol.HttpRequestExecutor;
|
||||||
import org.apache.http.protocol.ImmutableHttpProcessor;
|
import org.apache.http.protocol.ImmutableHttpProcessor;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for {@link HttpClient} implementations. This class acts as
|
* Base class for {@link HttpClient} implementations. This class acts as
|
||||||
|
@ -845,14 +846,12 @@ public abstract class AbstractHttpClient implements HttpClient {
|
||||||
result = responseHandler.handleResponse(response);
|
result = responseHandler.handleResponse(response);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
if (entity != null) {
|
try {
|
||||||
try {
|
EntityUtils.consume(entity);
|
||||||
entity.consumeContent();
|
} catch (Exception t2) {
|
||||||
} catch (Exception t2) {
|
// Log this exception. The original exception is more
|
||||||
// Log this exception. The original exception is more
|
// important and will be thrown to the caller.
|
||||||
// important and will be thrown to the caller.
|
this.log.warn("Error consuming content after an exception.", t2);
|
||||||
this.log.warn("Error consuming content after an exception.", t2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t instanceof Error) {
|
if (t instanceof Error) {
|
||||||
|
@ -873,11 +872,7 @@ public abstract class AbstractHttpClient implements HttpClient {
|
||||||
// Handling the response was successful. Ensure that the content has
|
// Handling the response was successful. Ensure that the content has
|
||||||
// been fully consumed.
|
// been fully consumed.
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
if (entity != null) {
|
EntityUtils.consume(entity);
|
||||||
// Let this exception go to the caller.
|
|
||||||
entity.consumeContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue