mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8219876: (bf) Improve IndexOutOfBoundsException messages in $Type$Buffer classes
Reviewed-by: alanb, rriggs
This commit is contained in:
parent
5c5089b0a2
commit
7211761cab
6 changed files with 14 additions and 27 deletions
|
@ -206,8 +206,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
|
|||
#if[char]
|
||||
|
||||
public String toString(int start, int end) {
|
||||
if ((end > limit()) || (start > end))
|
||||
throw new IndexOutOfBoundsException();
|
||||
Objects.checkFromToIndex(start, end, limit());
|
||||
try {
|
||||
int len = end - start;
|
||||
char[] ca = new char[len];
|
||||
|
@ -232,8 +231,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
|
|||
pos = (pos <= lim ? pos : lim);
|
||||
int len = lim - pos;
|
||||
|
||||
if ((start < 0) || (end > len) || (start > end))
|
||||
throw new IndexOutOfBoundsException();
|
||||
Objects.checkFromToIndex(start, end, len);
|
||||
return new ByteBufferAsCharBuffer$RW$$BO$(bb,
|
||||
-1,
|
||||
pos + start,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue