hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: svn commit: r1206731
Date Sun, 27 Nov 2011 16:06:10 GMT
On Sun, 2011-11-27 at 15:25 +0000, sebb@apache.org 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?
>                              InputStream instream = entity.getContent();
> -                            try {
> +                            if (instream != null) {

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.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message