[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-commons-dev
Subject:    DO NOT REPLY [Bug 27242] New:  -
From:       bugzilla () apache ! org
Date:       2004-02-26 5:33:29
Message-ID: 20040226053329.13447.qmail () nagoya ! betaversion ! org
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27242>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27242

"Socket Closed" IOException thrown by HttpConnection

           Summary: "Socket Closed" IOException thrown by HttpConnection
           Product: Commons
           Version: 2.0 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: HttpClient
        AssignedTo: commons-httpclient-dev@jakarta.apache.org
        ReportedBy: pvirkkul@pvirkkul.com


HttpClient.java was modified in version 2.0 Final in method executeMethod().
The call to connection.setSoTimeout() used to be in RC3 after the call to
connection.isOpen(), but in the final version the call happens before the call 
to isOpen(). The result of the change is that the setSoTimeout() call could 
throw IOException because of closed socket.

I would fix the problem by adding to HttpConnection.setSoTimeout() (and to 
other similar methods in HttpConnection) an explicit check (a call to isOpen
()) whether the socket is closed as the existence of socket object does not 
guarantee it. I.e the following code:

    public void setSoTimeout(int timeout)
        throws SocketException, IllegalStateException {
        LOG.debug("HttpConnection.setSoTimeout(" + timeout + ")");
        soTimeout = timeout;
        if (socket != null) {
            socket.setSoTimeout(timeout);
        }
    }

would be changed to

    public void setSoTimeout(int timeout)
        throws SocketException, IllegalStateException {
        LOG.debug("HttpConnection.setSoTimeout(" + timeout + ")");
        soTimeout = timeout;
        if (isOpen()) {
            socket.setSoTimeout(timeout);
        }
    }

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic