package o; import androidx.fragment.app.Fragment; import java.lang.reflect.InvocationTargetException; /* loaded from: classes.dex */ public class iAz { private static final DFj>> sClassCacheMap = new DFj<>(); private static Class loadClass(ClassLoader classLoader, String str) throws ClassNotFoundException { DFj>> dFj = sClassCacheMap; DFj> dFj2 = dFj.get(classLoader); if (dFj2 == null) { dFj2 = new DFj<>(); dFj.put(classLoader, dFj2); } Class cls = dFj2.get(str); if (cls != null) { return cls; } Class cls2 = Class.forName(str, false, classLoader); dFj2.put(str, cls2); return cls2; } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean isFragmentClass(ClassLoader classLoader, String str) { try { return Fragment.class.isAssignableFrom(loadClass(classLoader, str)); } catch (ClassNotFoundException unused) { return false; } } public static Class loadFragmentClass(ClassLoader classLoader, String str) { try { return loadClass(classLoader, str); } catch (ClassCastException e) { StringBuilder sb = new StringBuilder("Unable to instantiate fragment "); sb.append(str); sb.append(": make sure class is a valid subclass of Fragment"); throw new Fragment.InstantiationException(sb.toString(), e); } catch (ClassNotFoundException e2) { StringBuilder sb2 = new StringBuilder("Unable to instantiate fragment "); sb2.append(str); sb2.append(": make sure class name exists"); throw new Fragment.InstantiationException(sb2.toString(), e2); } } public Fragment instantiate(ClassLoader classLoader, String str) { try { return loadFragmentClass(classLoader, str).getConstructor(new Class[0]).newInstance(new Object[0]); } catch (IllegalAccessException e) { StringBuilder sb = new StringBuilder("Unable to instantiate fragment "); sb.append(str); sb.append(": make sure class name exists, is public, and has an empty constructor that is public"); throw new Fragment.InstantiationException(sb.toString(), e); } catch (InstantiationException e2) { StringBuilder sb2 = new StringBuilder("Unable to instantiate fragment "); sb2.append(str); sb2.append(": make sure class name exists, is public, and has an empty constructor that is public"); throw new Fragment.InstantiationException(sb2.toString(), e2); } catch (NoSuchMethodException e3) { StringBuilder sb3 = new StringBuilder("Unable to instantiate fragment "); sb3.append(str); sb3.append(": could not find Fragment constructor"); throw new Fragment.InstantiationException(sb3.toString(), e3); } catch (InvocationTargetException e4) { StringBuilder sb4 = new StringBuilder("Unable to instantiate fragment "); sb4.append(str); sb4.append(": calling Fragment constructor caused an exception"); throw new Fragment.InstantiationException(sb4.toString(), e4); } } }