mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8276806: Use Objects.checkFromIndexSize where possible in java.base
Reviewed-by: rriggs, lancea
This commit is contained in:
parent
30087cc1b8
commit
73a9654c26
11 changed files with 40 additions and 43 deletions
|
@ -32,6 +32,7 @@ import java.security.PrivilegedAction;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
@ -718,10 +719,7 @@ public class ObjectOutputStream
|
|||
if (buf == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
int endoff = off + len;
|
||||
if (off < 0 || len < 0 || endoff > buf.length || endoff < 0) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
Objects.checkFromIndexSize(off, len, buf.length);
|
||||
bout.write(buf, off, len, false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue