Matthew Gill created CAMEL-7459:
-----------------------------------
Summary: parseQuery Drops Last Char When Last Parameter is RAW
with value ending with ')'
Key: CAMEL-7459
URL: https://issues.apache.org/jira/browse/CAMEL-7459
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 2.11.0
Reporter: Matthew Gill
Priority: Minor
When processing RAW parameters as part of parseQuery a look ahead to the next
char is needed in order to determine the end of the RAW value. The logic to
prevent a _StringIndexOutOfBoundsException_ drops the last char when evaluating
for _next_ char when the current char (_i_) is the second to last char of the
string.
This becomes an issue when the RAW value ends in ')'
Consider:
uri = "foo=RAW(ba(r))"
uri.length() = 14
i = 12
uri.charAt(12) = ')'
uri.charAt(13) = ')'
(i < uri.legnth() - 2) = 12 < (14 - 2) = 12 < 12 = false
thus next = "\u0000"
The RAW value now ends satisfying the requirements and the char at index 13 is
never read. The resulting parameter is "foo=RAW(ba(r)".
The logic to prevent the index exception should be "(i <*=* uri.legnth() -2)"
or "(i < uri.legnth() - *1*)"
--
This message was sent by Atlassian JIRA
(v6.2#6252)