Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF4E39480 for ; Fri, 30 Dec 2011 06:59:59 +0000 (UTC) Received: (qmail 37301 invoked by uid 500); 30 Dec 2011 06:59:59 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 37277 invoked by uid 500); 30 Dec 2011 06:59:57 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 37270 invoked by uid 99); 30 Dec 2011 06:59:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2011 06:59:55 +0000 X-ASF-Spam-Status: No, hits=-2001.3 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2011 06:59:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 9329A13089C for ; Fri, 30 Dec 2011 06:59:30 +0000 (UTC) Date: Fri, 30 Dec 2011 06:59:30 +0000 (UTC) From: "Willem Jiang (Assigned) (JIRA)" To: issues@camel.apache.org Message-ID: <1546342440.53525.1325228370604.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2134302868.51734.1325174492135.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Assigned] (CAMEL-4841) URISupport: URI normalization duplicates query if path is empty MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CAMEL-4841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Willem Jiang reassigned CAMEL-4841: ----------------------------------- Assignee: Willem Jiang > URISupport: URI normalization duplicates query if path is empty > --------------------------------------------------------------- > > Key: CAMEL-4841 > URL: https://issues.apache.org/jira/browse/CAMEL-4841 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.8.3 > Reporter: Anton Koscejev > Assignee: Willem Jiang > Priority: Minor > > URI with empty path, but non-empty query part is not properly normalized. The query part is in fact duplicated. E.g, URI "foobar://?foo=1&bar=2" is incorrectly normalized to "foobar://?foo=1&bar=2?bar=2&foo=1". > This is caused by incorrect identification of the path part in org.apache.camel.util.URISupport.normalizeUri(String): > int idx = path.indexOf('?'); > if (idx > 0) { > path = path.substring(0, idx); > } > The comparison of "idx > 0" is incorrect, because this way, if '?' is the first character, the path is not set to empty string. The correct comparison should be "idx > -1" or "idx >= 0" or even just "idx != -1" since that's the only value that String.indexOf returns when the character is not found. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira