Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0FF7E10DDE for ; Mon, 17 Mar 2014 10:27:00 +0000 (UTC) Received: (qmail 29433 invoked by uid 500); 17 Mar 2014 10:26:50 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 28905 invoked by uid 500); 17 Mar 2014 10:26:44 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 28869 invoked by uid 99); 17 Mar 2014 10:26:42 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Mar 2014 10:26:42 +0000 Date: Mon, 17 Mar 2014 10:26:42 +0000 (UTC) From: "Dominik Bennersdorfer (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HTTPCLIENT-1485) Wrong type of exception raised because of hardcoded string-compare MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Dominik Bennersdorfer created HTTPCLIENT-1485: ------------------------------------------------- Summary: Wrong type of exception raised because of hardcoded s= tring-compare Key: HTTPCLIENT-1485 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1485 Project: HttpComponents HttpClient Issue Type: Bug Components: HttpClient Affects Versions: 4.3.3, 4.3.2 Reporter: Dominik Bennersdorfer In the lines org.apache.http.impl.conn.HttpClientConnectionOperator.java:13= 4-143 we found that the message of the ConnectException is compared to the = hardcoded string "Connection timed out". This can causes wrong break down to the http-client own Exception-types on = Systems with other languages. } catch (final ConnectException ex) { =09if (last) { =09=09final String msg =3D ex.getMessage(); =09=09if ("Connection timed out".equals(msg)) { =09=09=09throw new ConnectTimeoutException(ex, host, addresses); =09=09} else { =09=09=09throw new HttpHostConnectException(ex, host, addresses); =09=09} =09} } To illustrate the Problem see the following Example: On our server the locale is set to "de_AT.ISO-8859-15@euro"=20 with a simple wget i get this (see the message in last line) root@MRW-MJA-vml1:/tmp# wget http://www.google.at:81 --2014-03-14 12:46:44-- http://www.google.at:81/ Aufl=C3=B6sen des Hostnamen www.google.at... 173.194.39.183 Verbindungsaufbau zu www.google.at|173.194.39.183|:81... fehlgeschlagen: Di= e Wartezeit f=C3=BCr die Verbindung ist abgelaufen. after changing the locale to "en_US.ISO-8859-15" i get the following: root@MRW-MJA-vml1:/tmp# wget http://www.google.at:81 --2014-03-14 12:43:33-- http://www.google.at:81/ Resolving www.google.at... 173.194.32.223 Connecting to www.google.at|173.194.32.223|:81... failed: Connection timed = out. Example with httpclient 4.3.3 (parts from our tracing): Exception Message=20 Cause=20 =09at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpCl= ientConnectionOperator.java:138) =09at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(= PoolingHttpClientConnectionManager.java:314) =09at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClie= ntExec.java:357) =09at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.= java:218) =09at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java= :194) =09at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) =09at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java= :108) =09at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttp= Client.java:186) =09at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttp= Client.java:82) =09at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttp= Client.java:106) =09 We excpected to get a ConnectTimeoutException rather than a HttpHostConnect= Exception -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org