8306959: (bf) CharBuffer.append(CharSequence,int,int) throws BufferOverflowException where IndexOutOfBoundsException expected

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2023-04-27 17:20:08 +00:00
parent eb358619df
commit 80fae514b1
11 changed files with 387 additions and 11 deletions

View file

@ -2045,6 +2045,8 @@ public abstract sealed class $Type$Buffer
*/
public $Type$Buffer append(CharSequence csq, int start, int end) {
if (csq instanceof CharBuffer cb) {
Objects.checkFromToIndex(start, end, csq.length());
//
// the append method throws BufferOverflowException when
// there is insufficient space in the buffer