org.apache.camel.util.URISupport

line 158

if (i < uri.length() - 2) {

This instead should be:

if (i <= uri.length() - 2) {

The reason is that you are trying to calculate the next character.
So for example if we take the string "abc"
When i = 0   we are at 'a' and we calculate next as 'b'
But when i = 1 we are at 'b' and next should be 'c', but since the if
statement fails the else statement runs and next gets set to '\u0000'

"abc" is a simple example.  Let's try something more "real world" now.

The problem occurs when you have this example string:
"flatten=false&recursive=false&delete=true&include=RAW(%5E.*%5B.%5D(xml))"

If you try that string, you can see based on the logic when we get to the
"closed paren" after the l in xml... next gets set to '\u0000' instead of
')' like it should.  And then when we get to line 177
boolean end = ch == RAW_TOKEN_END.charAt(0) && (next == '&' || next ==
'\u0000');
end gets set to true, when really we are not at the end.  We had 1 more
"closed paren" to process.

Thus my last value gets set to RAW(%5E.*%5B.%5D(xml)
When it really should be RAW(%5E.*%5B.%5D(xml))

Thanks for correcting this.
-James



--
View this message in context: 
http://camel.465427.n5.nabble.com/org-apache-camel-util-URISupport-tp5751485.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to