On Fri, 2007-08-17 at 08:32 -0400, Steve Terrell wrote:
> Why would the second 'if' be a problem? The first test is to see if
> there is already a response stream. The second 'if' is only called when
> there is no response stream. In that case, if there is a response body,
> then create a stream from it.
> 
> My only change to this code would be to drop the local declaration of
> byteResponseStream, and instead use the class instance variable
> responseStream. This way, any subsequent calls to
> getResponseBodyAsStream would not have to create a new input stream. Of
> course, I don't know why you would call this method more than once...
> 

Steve,

All this ugly code we inherited from the 1.0 days is gone in the
HttpClient 4.0 branch. 

Oleg 

> --Steve
> 
> -----Original Message-----
> From: Bala mani [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 17, 2007 7:36 AM
> To: [email protected]
> Subject: found an Error in HttpMethodBase class
> 
> 
>    /**
>      * Returns the response body of the HTTP method, if any, as an
> [EMAIL PROTECTED]
> InputStream}. 
>      * If response body is not available, returns <tt>null</tt>
>      * 
>      * @return The response body or <code>null</code>.
>      * 
>      * @throws IOException If an I/O (transport) problem occurs while
> obtaining the 
>      * response body.
>      */
>     public InputStream getResponseBodyAsStream() throws IOException {
>         if (responseStream != null) {
>             return responseStream;
>         }
>         if (responseBody != null) {
>             InputStream byteResponseStream = new
> ByteArrayInputStream(responseBody);
>             LOG.debug("re-creating response stream from byte array");
>             return byteResponseStream;
>         }
>         return null;
>     }
> 
> the above code segment is part of the HttpMethodBase class.
> on observation we find that the second if is a dead code segment and 
> what correction is required.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to