Please review: surrogate fiddle
Xueming Shen
xueming.shen at oracle.com
Mon Mar 18 22:37:30 UTC 2013
The spec of both affected methods says "the char at the index is returned, if
the following conditions are not true
1) hi-surrogate &&
2) next index < count &&
3) char at next is lo-surrogate
So it is the right thing to do to simply return the char at index, if it is the last
char in the buffer.
Martin, the purpose of dup the code here is for better performance?
-Sherman
On 03/18/2013 03:13 PM, Martin Buchholz wrote:
> It does change the behavior. The existing behavior is clearly a bug, since it reads a char that should be inaccessible. I don't believe AIOOBE exception is thrown, with or without my fix.
>
>
> On Mon, Mar 18, 2013 at 3:08 PM, Mike Duigou <mike.duigou at oracle.com <mailto:mike.duigou at oracle.com>> wrote:
>
> This change would seem to change the result when a high surrogate is the last char in the String/StringBuilder/StringBuffer.
>
> Rather than throwing an ArrayIndexException it will return the high surrogate char.
>
> I am going to defer to Sherman on this. I don't know that returning the character is the right thing to do.
>
> Sherman?
>
> Mike
>
> On Mar 18 2013, at 14:28 , Martin Buchholz wrote:
>
>> Hello Jim, Mike,
>>
>> I'd like you to do a code review:
>>
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk8/surrogate-fiddle/ <http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk8/surrogate-fiddle/>
>
>
More information about the core-libs-dev
mailing list