Merge "Only construct real Throwable objects." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0868533760
@@ -52,10 +52,12 @@ public final class ParcelableException extends RuntimeException implements Parce
|
|||||||
final String msg = in.readString();
|
final String msg = in.readString();
|
||||||
try {
|
try {
|
||||||
final Class<?> clazz = Class.forName(name, true, Parcelable.class.getClassLoader());
|
final Class<?> clazz = Class.forName(name, true, Parcelable.class.getClassLoader());
|
||||||
return (Throwable) clazz.getConstructor(String.class).newInstance(msg);
|
if (Throwable.class.isAssignableFrom(clazz)) {
|
||||||
|
return (Throwable) clazz.getConstructor(String.class).newInstance(msg);
|
||||||
|
}
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (ReflectiveOperationException e) {
|
||||||
throw new RuntimeException(name + ": " + msg);
|
|
||||||
}
|
}
|
||||||
|
return new RuntimeException(name + ": " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
|||||||
Reference in New Issue
Block a user