camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neil Stevens <>
Subject Bug in camel URISupport?
Date Fri, 22 Aug 2014 22:53:15 GMT

I think I have found a bug in camel-core and I'm hoping someone may be
able confirm if I am right about this.  In camel it is not possible
for a URI endpoint to have a query parameter with a value containing
an '&' symbol.  The bug affects all endpoint types

For example its possible that a camel route may consume from an FTP
endpoint with a password conatining an '&' symbol.  For example if I
wanted to connect to my FTP server in passive mode with a password of
"Guns&Roses" I would expect the URI to be


When Camel attempts to parse this URI it mistakenly divides
"password=Guns%26Roses&passiveMode=true" into 3 parameters:
password=Guns, Roses=null, passiveMode=true.

I've followed the code through and this appears to be a bug in the
"parseParameters" method of URISupport class within camel-core.  This
method uses Java's URI::getQuery method to return the query part of
the string. This string is then split at '&' characters.  The problem
is the URI::getQuery method will return the "decoded" query part of
the URI, when the "encoded" query part should be used  (We require the
string "?password=Guns%26Roses&passiveMode=true" when URI::getQuery
returns "?password=Guns&Roses&passiveMode=true").  This then causes
the split by '&' to split the query parameters incorrectly

The Javadoc for
confims "The getUserInfo, getPath, getQuery, getFragment,
getAuthority, and getSchemeSpecificPart methods decode any escaped
octets in their corresponding components. The strings returned by
these methods may contain both other characters and illegal
characters, and will not contain any escaped octets.".  Therefore the
code should be altered to retrieve the enncoded query string.  This
would be a very simple as would simply mean modifying the line "String
query = uri.getQuery();" to "String query = uri.getRawQuery()".

Could a camel developer confirm if they agree that this is a bug.  If
it is I would be happy to have a go at contributing the fix with a
unit test if some one can advise me how I should go about doing this


View raw message