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

Chris Hegarty chris.hegarty at oracle.com
Thu Sep 20 03:42:51 PDT 2012


Firstly, to clarify, I agree with this change.

On 20/09/2012 11:38, Alan Bateman wrote:
> On 20/09/2012 11:27, Chris Hegarty wrote:
>> 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.
> I'm not following you, all put methods should be specified to throw
> ReadOnlyBufferException if the buffer is read-only. CharBuffer
> additionally implements Appendable and so its append methods are also
> specified to throw this exception for read-only buffers. Can you clarify
> what you mean?

My comment here is that I think put(CharBuffer src) will throw 
BufferOverflowException even if the buffer is read only. Where as the 
other put methods do the opposite, right?

-Chris.

>
> -Alan.


More information about the nio-dev mailing list