7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer

Chris Hegarty chris.hegarty at oracle.com
Thu Sep 20 03:27:19 PDT 2012


A little tricky to review, but looks fine.

I am a little perplexed that the put($Type$Buffer) methods are specified 
to throw BOE, rather than ROBE (in this case), but not the other put's 
or append's. It is understandable that we do not want to change this 
behavior now.

-Chris.

On 19/09/2012 18:09, Alan Bateman wrote:
>
> This one is a behavioral change caused by the 7190219 [1]. If
> CharBuffer.put(String) or append(String) is invoked on a read-only
> buffer, and the buffer has fewer elements remaining than the String
> length, then BufferOverflowException is thrown rather than
> ReadOnlyBufferException. Technically where there is more than one
> possible exception then it shouldn't matter which one is thrown but in
> this case ReadOnlyBufferException is preferable and has been the long
> standing behavior.
>
> The webrev with the proposed change (trivial) is here:
>
> http://cr.openjdk.java.net/~alanb/7199551/webrev/
>
> In the webrev then the test classes are generated, only BasicChar.java
> has the new tests, the others can be ignored.
>
> I see that 7190219 has also been pushed to jdk7u so that may need to be
> looked at too.
>
> Thanks,
> Alan.
>
> [1] http://hg.openjdk.java.net/jdk8/tl/jdk/rev/bf0c6f91bc22


More information about the nio-dev mailing list