mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8268698: Use Objects.check{Index,FromToIndex,FromIndexSize} for java.base
Reviewed-by: mchung, rriggs
This commit is contained in:
parent
a4e5f08fef
commit
afe957cd97
40 changed files with 186 additions and 284 deletions
|
@ -709,10 +709,8 @@ public final class Integer extends Number
|
|||
public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix)
|
||||
throws NumberFormatException {
|
||||
Objects.requireNonNull(s);
|
||||
Objects.checkFromToIndex(beginIndex, endIndex, s.length());
|
||||
|
||||
if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
if (radix < Character.MIN_RADIX) {
|
||||
throw new NumberFormatException("radix " + radix +
|
||||
" less than Character.MIN_RADIX");
|
||||
|
@ -892,10 +890,8 @@ public final class Integer extends Number
|
|||
public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix)
|
||||
throws NumberFormatException {
|
||||
Objects.requireNonNull(s);
|
||||
Objects.checkFromToIndex(beginIndex, endIndex, s.length());
|
||||
|
||||
if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
int start = beginIndex, len = endIndex - beginIndex;
|
||||
|
||||
if (len > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue