diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-07-19 16:32:02 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-07-19 17:05:30 -0700 |
commit | 450d8c5b7c936b00fd0d40b5d68670df0fe56daa (patch) | |
tree | 29c51655adfa79e4525bbaccc425edf488f5ddcc /core/java/android/util | |
parent | 597945fd3a6b52ac70bb9afc5ec8c59039fffd77 (diff) | |
download | frameworks_base-450d8c5b7c936b00fd0d40b5d68670df0fe56daa.zip frameworks_base-450d8c5b7c936b00fd0d40b5d68670df0fe56daa.tar.gz frameworks_base-450d8c5b7c936b00fd0d40b5d68670df0fe56daa.tar.bz2 |
Fix issue #9940105: IllegalArgumentException in ArrayMap
Try to deal with unmarshalling old parcels. Turns out someone
was writing a parcel to disk storing a Bundle. Naughty, naughty.
This helps us not completely keel over.
Change-Id: Id343da2690b7bab89f6c3cb6fad1b92f270dad03
Diffstat (limited to 'core/java/android/util')
-rw-r--r-- | core/java/android/util/ArrayMap.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java index 51014c8..22f62d7 100644 --- a/core/java/android/util/ArrayMap.java +++ b/core/java/android/util/ArrayMap.java @@ -247,6 +247,20 @@ public final class ArrayMap<K, V> implements Map<K, V> { } /** + * @hide + * Like {@link #clear}, but doesn't reduce the capacity of the ArrayMap. + */ + public void erase() { + if (mSize > 0) { + final int N = mSize<<1; + final Object[] array = mArray; + for (int i=0; i<N; i++) { + array[i] = null; + } + } + } + + /** * Ensure the array map can hold at least <var>minimumCapacity</var> * items. */ @@ -421,8 +435,13 @@ public final class ArrayMap<K, V> implements Map<K, V> { throw new IllegalStateException("Array is full"); } if (index > 0 && mHashes[index-1] > hash) { - throw new IllegalArgumentException("New hash " + hash - + " is before end of array hash " + mHashes[index-1]); + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "New hash " + hash + + " is before end of array hash " + mHashes[index-1] + + " at index " + index + " key " + key, e); + put(key, value); + return; } mSize = index+1; mHashes[index] = hash; |