diff options
| author | 2013-09-27 11:23:08 -0700 | |
|---|---|---|
| committer | 2013-09-27 11:23:08 -0700 | |
| commit | 12fd0f1644b28b6938a504492397e8ca8d38a1c5 (patch) | |
| tree | 40b7dcdead27c9a2c3c0100a8bb39281d8a0b338 | |
| parent | bf15c7cecefba8fdb3070c389a4966f11a8d8656 (diff) | |
| parent | f6a0c11615bd5c2c934527a0b20ba13f958913c4 (diff) | |
am f6a0c116: am 9bf1a139: am 72c5e376: am ba1ae3af: am 42786418: Don\'t instantiate non-Fragments in Fragment.instantiate
* commit 'f6a0c11615bd5c2c934527a0b20ba13f958913c4':
Don't instantiate non-Fragments in Fragment.instantiate
| -rw-r--r-- | core/java/android/app/Fragment.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java index b6aeb84bdb54..422d0bc1dace 100644 --- a/core/java/android/app/Fragment.java +++ b/core/java/android/app/Fragment.java @@ -580,6 +580,10 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene if (clazz == null) { // Class not found in the cache, see if it's real, and try to add it clazz = context.getClassLoader().loadClass(fname); + if (!Fragment.class.isAssignableFrom(clazz)) { + throw new InstantiationException("Trying to instantiate a class " + fname + + " that is not a Fragment", new ClassCastException()); + } sClassMap.put(fname, clazz); } Fragment f = (Fragment)clazz.newInstance(); |