hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: NullPointerException in HttpMethodBase
Date Fri, 13 Jun 2003 21:35:43 GMT
Fix applied.

Oleg


On Fri, 2003-06-13 at 17:55, Thomas Winkler wrote:
> hi,
> there is NullPointer in HttpMethodBase.getResponseBody() when
> HttpMethodBase.getResponseBodyAsStream() returns null.
> 
>   InputStream is = getResponseBodyAsStream();
>   byte[] buffer = new byte[4096];
>   int len;
>   while ((len = is.read(buffer)) > 0) {
>        os.write(buffer, 0, len);
>   }
> 
> when null is returned the is.read(buffer) throws a NullPointerException,
> that is quite an unexpected behaviour. since getResponseBodyAsStream()
> (and getResponseBody as well) might by definition return null, the "is
> == null" case should be handled in some way (probably using
> responseAvailable()). i guess getting HttpMethodBase.getResponseBody()
> to return null in this case would solve this issue.
> 
> i am using a cvs snapshot from early may, but the recent cvs still holds
> the same issue.
> 
> thank you,
> thomas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
> 


Mime
View raw message