You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2003/11/02 17:07:27 UTC

PATCH: HttpConnection cleanup

Folks,

This patch has been prompted by the questions/concerns raised by Fabio
<linea at libero.it>. Let's face it, HttpConnection has got a bit messy
with all the numerous changes made recently. In particular the exception
handling especially with regards to handling recoverable exceptions and
timeouts got muddy. This patch attempts to address the problem

changelog:

- Socket input stream now wrapped with a wrapper class that re-throws
certain type of generic IO exceptions as HttpClient specific exceptions.
In particular java.io.InterruptedIOExceptions are re-thrown as
IOTimeoutException
- java.io.InterruptedIOExceptions in HttpConnection#open() re-thrown as
ConnectTimeoutException
- HttpConnection#write(byte[], int, int) used to throw
HttpRecoverableException in case of getting absolutely messed up
parameters. changed to throw IllegalArgumentException instead
- HttpConnection#write(byte[], int, int) does not do any exception
handling anymore, since this is clearly a prerogative of the
WrappedOutputStream
- 'used' flag in HttpConnection was set to true only upon the connection
release. Why? Was there any reason for this kind of behavior? That doest
not seem right to me. Changed to set 'used' flag upon first successful
write operation. Mike, please have a close look. Let me know if you
disagree with the change. It can well be that I missed something
important.
- close() and flush() in WrappedOutputStream no longer throw
HttpRecoverableExceptions. I believe this kind of exceptions are too
severe to be automatically recovered from

Let me know what you think

Oleg