Charles Moulliard created CAMEL-7460:
----------------------------------------

             Summary: Conditin tested by URISupport.parseQuery() is not correct
                 Key: CAMEL-7460
                 URL: https://issues.apache.org/jira/browse/CAMEL-7460
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.13.0, 2.12.0, 2.11.0
            Reporter: Charles Moulliard
            Assignee: Charles Moulliard


org.apache.camel.util.URISupport

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

This instead should be:

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

Why :

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))



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to