hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1362) Confusing message in HttpHostConnectException
Date Mon, 03 Jun 2013 08:34:22 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13672894#comment-13672894

Oleg Kalnichevski commented on HTTPCLIENT-1362:


This confusion is not of HttpClient making. The Socket#connect method is supposed to throw
SocketTimeoutException in case of a connect timeout [1] whereas ConnectException is meant
to signal an error connecting to a particular remote endpoint (hence the message). 

What we can do though is to re-use the message of the original exception when re-throwing
it as HttpHostConnectException.


[1] http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#connect%28java.net.SocketAddress,%20int%29
[2] http://docs.oracle.com/javase/7/docs/api/java/net/ConnectException.html
> Confusing message in HttpHostConnectException
> ---------------------------------------------
>                 Key: HTTPCLIENT-1362
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1362
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>            Reporter: Sergey B.
>            Priority: Trivial
>              Labels: exception
> TCP connection can fail with two different kind of errors: 'Connection timed' out and
'Connection refused'. When a connection error occurs HttpClient catches SocketException and
replaces it with HttpHostConnectException. In addition to exception class it replaces exception
message, changing original text with 'Connection to ... refused'. This message is confusing
because it looks very much like SocketException 'Connection refused', but in fact it hides
original 'Connection timed out'.
> Consider using different messages in HttpHostConnectException depending on parent exception.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

View raw message