You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2011/11/27 16:28:29 UTC
svn commit: r1206734 -
/httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpClient4.java
Author: sebb
Date: Sun Nov 27 15:28:28 2011
New Revision: 1206734
URL: http://svn.apache.org/viewvc?rev=1206734&view=rev
Log:
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
Modified:
httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpClient4.java
Modified: httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpClient4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpClient4.java?rev=1206734&r1=1206733&r2=1206734&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpClient4.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpClient4.java Sun Nov 27 15:28:28 2011
@@ -139,16 +139,16 @@ public class TestHttpClient4 implements
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
- try {
- contentLen = 0;
- if (instream != null) {
+ contentLen = 0;
+ if (instream != null) {
+ try {
int l = 0;
while ((l = instream.read(buffer)) != -1) {
contentLen += l;
}
+ } finally {
+ instream.close();
}
- } finally {
- instream.close();
}
}
if (response.getStatusLine().getStatusCode() == 200) {