mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +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
|
@ -28,6 +28,7 @@ package java.util.zip;
|
|||
import java.io.FilterInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Implements an input stream filter for compressing data in the "deflate"
|
||||
|
@ -172,9 +173,9 @@ public class DeflaterInputStream extends FilterInputStream {
|
|||
ensureOpen();
|
||||
if (b == null) {
|
||||
throw new NullPointerException("Null buffer for read");
|
||||
} else if (off < 0 || len < 0 || len > b.length - off) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
} else if (len == 0) {
|
||||
}
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue