summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Irfan Sheriff <isheriff@google.com> 2013-01-11 10:45:51 -0800
committer Irfan Sheriff <isheriff@google.com> 2013-01-11 10:45:51 -0800
commit97a72f6693a7bee3255b2307c6bb18f66669a36c (patch)
tree1c7c7b3b1f7aa9487db8e1a0c15b7b89e207fc07
parentd6a7925d14231c016e84db53fb5a5bbab5a07d84 (diff)
Handle missing static for CREATOR
I made a mistake of missing out on static for CREATOR on a Parcelable and it threw a NPE which was not obvious. We do not get NoSuchFieldException when CREATOR exists but is not static. Change-Id: Ib06f60797c00722075255d45e8189f8cebef9ae2
-rw-r--r--core/java/android/os/Parcel.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 788ab7401cc6..d69fef0b7249 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -2087,6 +2087,10 @@ public final class Parcel {
+ "Parcelable.Creator object called "
+ " CREATOR on class " + name);
}
+ catch (NullPointerException e) {
+ throw new BadParcelableException("Parcelable protocol requires "
+ + "the CREATOR object to be static on class " + name);
+ }
if (creator == null) {
throw new BadParcelableException("Parcelable protocol requires a "
+ "Parcelable.Creator object called "