This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
The following commit(s) were added to refs/heads/master by this push: new 7949824 Use Objects.requireNonNull() instead of custom check. Minor formatting. 7949824 is described below commit 794982496f618420a32ffa7cd6025786a7eebab7 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Dec 25 21:27:07 2019 -0500 Use Objects.requireNonNull() instead of custom check. Minor formatting. --- .../imaging/common/bytesource/ByteSourceInputStream.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java index cbb0da2..25155c8 100644 --- a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java +++ b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java @@ -20,6 +20,7 @@ import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.util.Objects; import org.apache.commons.imaging.common.BinaryFunctions; @@ -119,12 +120,11 @@ public class ByteSourceInputStream extends ByteSource { } @Override - public int read(final byte[] b, final int off, final int len) throws IOException { + public int read(final byte[] array, final int off, final int len) throws IOException { // first section copied verbatim from InputStream - if (b == null) { - throw new NullPointerException(); - } else if ((off < 0) || (off > b.length) || (len < 0) - || ((off + len) > b.length) || ((off + len) < 0)) { + Objects.requireNonNull(array, "array"); + if ((off < 0) || (off > array.length) || (len < 0) + || ((off + len) > array.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; @@ -154,7 +154,7 @@ public class ByteSourceInputStream extends ByteSource { } final int readSize = Math.min(len, block.bytes.length - blockIndex); - System.arraycopy(block.bytes, blockIndex, b, off, readSize); + System.arraycopy(block.bytes, blockIndex, array, off, readSize); blockIndex += readSize; return readSize; }