Stop using Arrays.checkOffsetAndCount.

Start using ArrayUtils.throwsIfOutOfBounds instead. The Arrays method
is going to be removed.

Bug: 78447530
Test: cts-tradefed run cts-dev -m CtsOsTestCases (shows only unrelated failures: two user/userdebug mismatches and one from b/79471510)
Test: cts-tradefed run cts-dev -m CtsDrmTestCases
Test: adb shell am instrument -w -e class android.content.pm.LimitedLengthInputStreamTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -e class android.os.FileBridgeTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ib3cd4f4ead61dbec1ccdc94b2ad4ad9c28574582
This commit is contained in:
Pete Gillin
2018-05-10 15:40:32 +01:00
parent d0b9f983d6
commit 60f55a255f
4 changed files with 10 additions and 9 deletions

View File

@@ -27,13 +27,13 @@ import android.util.Log;
import libcore.io.IoBridge;
import libcore.io.Streams;
import libcore.util.ArrayUtils;
import java.io.FileDescriptor;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.UnknownServiceException;
import java.util.Arrays;
/**
* Stream that applies a {@link DrmManagerClient} transformation to data before
@@ -91,7 +91,7 @@ public class DrmOutputStream extends OutputStream {
@Override
public void write(byte[] buffer, int offset, int count) throws IOException {
Arrays.checkOffsetAndCount(buffer.length, offset, count);
ArrayUtils.throwsIfOutOfBounds(buffer.length, offset, count);
final byte[] exactBuffer;
if (count == buffer.length) {