Codereview request 7067045: replaceAll("\u20ac", "$"); causses java.lang.StringIndexOutOfBoundsExceptio
paul.sandoz at oracle.com
Tue Apr 17 10:02:23 PDT 2012
Here is an example:
I am not sure what, if any, are the JDK guidelines for stuffing information in exception messages.
On Apr 16, 2012, at 10:24 AM, Paul Sandoz wrote:
> Hi Sherman,
> IMHO it is worth spending a little time getting the exception messages a little more accurate. I have spent too many a time staring at such messages wondering what the heck is going on :-)
> Syntax error parsing replacement string: escaped literal character is missing at the end of the string.
> Syntax error parsing replacement string: group reference is missing at the end of the string.
> Since i am proposing this i will send a patch. It will help me get familiar with the whole OpenJDK process.
> On Apr 12, 2012, at 10:09 PM, Xueming Shen wrote:
>> Please help review the change for 7067045.
>> The change is to throw a more meaningful IAE instead of the StringIndexoutputOfBoundsException
>> if backslash or $ is the last character in the replacement string. (as the API indicated, the backslash
>> and $ character in String's regex replacement and Matcher class have special meanings, backslash
>> is for literal character escape and the $ is the capturing group reference, which needs a group index).
More information about the core-libs-dev