Not sure that instream can be null, but assuming it can, there's no point entering the try block if it's null. This avoids NPE warning

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1206731 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2011-11-27 15:25:53 +00:00
parent d7ce4582e2
commit 6921a32fa6
1 changed files with 9 additions and 9 deletions

View File

@ -180,18 +180,18 @@ public class TestHttpCore implements TestHttpAgent {
httpexecutor.postProcess(response, httpproc, context);
HttpEntity entity = response.getEntity();
if (entity != null) {
if (entity != null) { // TODO can this be null?
InputStream instream = entity.getContent();
try {
if (instream != null) {
contentLen = 0;
if (instream != null) {
int l = 0;
while ((l = instream.read(buffer)) != -1) {
contentLen += l;
}
try {
int l = 0;
while ((l = instream.read(buffer)) != -1) {
contentLen += l;
}
} finally {
instream.close();
}
} finally {
instream.close();
}
}
if (connStrategy.keepAlive(response, context)) {