camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwblackw <>
Subject org.apache.camel.util.URISupport
Date Thu, 22 May 2014 19:19:54 GMT

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:

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 ==
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.

View this message in context:
Sent from the Camel Development mailing list archive at

View raw message