camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Koscejev (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-4841) URISupport: URI normalization duplicates query if path is empty
Date Thu, 29 Dec 2011 16:01:32 GMT
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
            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

        

Mime
View raw message