On 27 November 2011 16:06, Oleg Kalnichevski <[email protected]> wrote:
> On Sun, 2011-11-27 at 15:25 +0000, [email protected] wrote:
>> Author: sebb
>> Date: Sun Nov 27 15:25:53 2011
>> New Revision: 1206731
>>
>> URL: http://svn.apache.org/viewvc?rev=1206731&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/TestHttpCore.java
>>
>> Modified: 
>> httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpCore.java
>> URL: 
>> http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpCore.java?rev=1206731&r1=1206730&r2=1206731&view=diff
>> ==============================================================================
>> --- 
>> httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpCore.java
>>  (original)
>> +++ 
>> httpcomponents/httpclient/trunk/httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/TestHttpCore.java
>>  Sun Nov 27 15:25:53 2011
>> @@ -180,18 +180,18 @@ public class TestHttpCore implements Tes
>>                          httpexecutor.postProcess(response, httpproc, 
>> context);
>>
>>                          HttpEntity entity = response.getEntity();
>> -                        if (entity != null) {
>> +                        if (entity != null) { // TODO can this be null?

Oops, added comment to the wrong line ...

>>                              InputStream instream = entity.getContent();
>> -                            try {
>> +                            if (instream != null) {

Intended to put it here.

>
> HttpEntity may be null for those responses that are not allowed to
> enclose an entity by the HTTP spec (such as 304 Not Modified).
>
> InputStream may not be null unless the message is received over a
> non-blocking connection. This applies to HttpCore NIO and
> HttpAsyncClient only.

AFAICT, TestHttpCore does not test NIO or async, so presumably the
null check could be removed?
Likewise in TestHttpClient4?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to