mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8306959: (bf) CharBuffer.append(CharSequence,int,int) throws BufferOverflowException where IndexOutOfBoundsException expected
Reviewed-by: alanb
This commit is contained in:
parent
eb358619df
commit
80fae514b1
11 changed files with 387 additions and 11 deletions
|
@ -289,6 +289,8 @@ class Heap$Type$Buffer$RW$
|
|||
private $Type$Buffer appendChars(CharSequence csq, int start, int end) {
|
||||
checkSession();
|
||||
|
||||
Objects.checkFromToIndex(start, end, csq.length());
|
||||
|
||||
int length = end - start;
|
||||
int pos = position();
|
||||
int lim = limit();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue