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

-----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.

-- 
View this message in context:
http://www.nabble.com/found-an-Error-in-HttpMethodBase-class-tf4285189.h
tml#a12198079
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


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

Reply via email to