Skip to content
Snippets Groups Projects
Commit 9bf1a139 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am 72c5e376: am ba1ae3af: am 42786418: Don\'t instantiate non-Fragments in Fragment.instantiate

* commit '72c5e376':
  Don't instantiate non-Fragments in Fragment.instantiate
parents 1c5e33d3 72c5e376
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment