Roman Kennke wrote:
Hi there

This fixes a problem with sliced StringCharBuffers. See:

http://bugs.sun.com/view_bug.do?bug_id=6546113

Feel free to integrate this in the repository.

Ping, any opinions on this?

/Roman
I think Iris has been meaning to get back to you on this for a while (she has been busy). It's a bug that she & I spoke about a few months ago and she had planned to fix. All the better that you are now taking time to address it. If you look at 4997655 you will see that slicing a CharBuffer that wraps a char sequence has been problematic since day one. The changes for that bug in jdk6 fixed some problems but also lead to this problem. Unfortunately, the bug wasn't caught by existing tests so one thing that would be good to do as part of 6546113 is to add or improve the regression tests for char buffers that wrap a char sequence. Are you interested in doing that as part of the fix to this bug? Anyway, your changes look like a reasonable fix for the get methods. Did you check the toString, subSequence, and duplicate methods in case they have the same problem? One small concern is that the offset field was originally the offset into the backing array for heap buffers. Now it is used as the offset into the char sequence in the wrapped case. We should probably comment that for the sake of future maintainers or else add a new strOffset field to StringCharBuffer to make it easier to understand.

-Alan.

Reply via email to