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,20 +180,20 @@ 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 {
contentLen = 0;
if (instream != null) {
contentLen = 0;
try {
int l = 0;
while ((l = instream.read(buffer)) != -1) {
contentLen += l;
}
}
} finally {
instream.close();
}
}
}
if (connStrategy.keepAlive(response, context)) {
reusable = true;
}