[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    svn commit: r1206734 -
From:       sebb () apache ! org
Date:       2011-11-27 15:28:29
Message-ID: 20111127152829.A9D9E23889ED () eris ! apache ! org
[Download RAW message or body]

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) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic