diff options
author | Alan Viverette <alanv@google.com> | 2013-12-02 21:20:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-12-02 21:20:07 +0000 |
commit | 8af04d8b85183978aa6182c281325394bf47a593 (patch) | |
tree | eae11eb49f02f5d8e0e8bdea1ac0049ddfd65f57 | |
parent | d786a1900e94c4f0c919b50b44667cea32fd2939 (diff) | |
parent | db24d142f5202c79128d98cd031be8c34c0731f7 (diff) | |
download | frameworks_base-8af04d8b85183978aa6182c281325394bf47a593.zip frameworks_base-8af04d8b85183978aa6182c281325394bf47a593.tar.gz frameworks_base-8af04d8b85183978aa6182c281325394bf47a593.tar.bz2 |
Merge "Fix LongArray.addAll() to use correct arraycopy argument order"
-rw-r--r-- | core/java/android/util/LongArray.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/util/LongArray.java b/core/java/android/util/LongArray.java index 7d42063..290a89b 100644 --- a/core/java/android/util/LongArray.java +++ b/core/java/android/util/LongArray.java @@ -83,7 +83,7 @@ public class LongArray implements Cloneable { final int count = values.mSize; ensureCapacity(count); - System.arraycopy(mValues, mSize, values.mValues, 0, count); + System.arraycopy(values.mValues, 0, mValues, mSize, count); mSize += count; } @@ -127,6 +127,9 @@ public class LongArray implements Cloneable { * Returns the value at the specified position in this array. */ public long get(int index) { + if (index >= mSize) { + throw new ArrayIndexOutOfBoundsException(mSize, index); + } return mValues[index]; } @@ -148,6 +151,9 @@ public class LongArray implements Cloneable { * Removes the value at the specified index from this array. */ public void remove(int index) { + if (index >= mSize) { + throw new ArrayIndexOutOfBoundsException(mSize, index); + } System.arraycopy(mValues, index, mValues, index + 1, mSize - index); } |