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

Alan Bateman Alan.Bateman at oracle.com
Wed Sep 19 10:09:36 PDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20120919/1832b5f8/attachment.html 


More information about the nio-dev mailing list