diff options
author | Anna Papitto <annapapitto@google.com> | 2022-12-02 15:56:56 -0800 |
---|---|---|
committer | Anna Papitto <annapapitto@google.com> | 2022-12-19 10:26:41 -0800 |
commit | 9b7c3ac11f968364799537040f4765b881ed96ae (patch) | |
tree | 8f8772b8da671f5b55aaa12700a7b6a52a271f72 /org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io | |
parent | 0d10ebe5602bc31cd7176f0df8470b4ba6014d89 (diff) | |
download | jgit-9b7c3ac11f968364799537040f4765b881ed96ae.tar.gz jgit-9b7c3ac11f968364799537040f4765b881ed96ae.zip |
IO#readFully: provide overload that fills the full array
IO#readFully is often called with the intent to fill the destination
array from beginning to end. The redundant arguments for where to start
and stop filling are opportunities for bugs if specified incorrectly or
if not changed to match a changed array length.
Provide a overloaded method for filling the full destination array.
Change-Id: I964f18f4a061189cce1ca00ff0258669277ff499
Signed-off-by: Anna Papitto <annapapitto@google.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java index 648416925c..76bda6a35b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java @@ -91,7 +91,7 @@ public class TimeoutInputStreamTest { final byte[] exp = new byte[] { 'a', 'b', 'c' }; final byte[] act = new byte[exp.length]; out.write(exp); - IO.readFully(is, act, 0, act.length); + IO.readFully(is, act); assertArrayEquals(exp, act); } @@ -110,7 +110,7 @@ public class TimeoutInputStreamTest { public void testTimeout_readBuffer_Timeout() throws IOException { beginRead(); try { - IO.readFully(is, new byte[512], 0, 512); + IO.readFully(is, new byte[512]); fail("incorrectly read bytes"); } catch (InterruptedIOException e) { // expected |