Code review request 7190219 CharBuffer position changed after BufferOverflowException in put()

Jonathan Lu luchsh at linux.vnet.ibm.com
Thu Aug 9 12:16:43 UTC 2012


Hi folks,

Here's a patch for bug 7190219, could you please help to have a look?
http://cr.openjdk.java.net/~luchsh/7190219/

According to the specification, in the method 
java.nio.CharBuffer.put(String src, int start, int end).
If there are more chars to be copied from the string than remain in this 
buffer, that is, if end - start > remaining(), then no chars are 
transferred and a|BufferOverflowException||| 
<cid:part1.03040006.09080809 at linux.vnet.ibm.com> is thrown.

But actually the test case from that webrev proves that the buffer was 
modified even after BufferOverflowException, so I suggest to add 
additional check after checkBounds() call, in the same way as 
java.nio.CharBuffer.put(char[] src, int offset, int length).

Thanks
Jonathan



More information about the core-libs-dev mailing list