package o; import com.huawei.hms.framework.network.grs.GrsBaseInfo; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController; import java.util.Hashtable; import org.apache.commons.logging.LogConfigurationException; /* renamed from: o.gkl, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public class C15225gkl extends AbstractC15217gkd { private static final String[] a = {"o.gkq", "o.gkn", "o.gkp", "o.gkx"}; private static Class b; private static Class c; private static Class d; private static Class e; private boolean f; private boolean g; private boolean h; private String i; private Method l; private String m; private Class[] n; private Class[] q; private boolean p = true; private Hashtable j = new Hashtable(); /* renamed from: o, reason: collision with root package name */ private Hashtable f9141o = new Hashtable(); private Constructor k = null; public C15225gkl() { String str; Class[] clsArr = new Class[1]; Class cls = c; if (cls == null) { cls = d("java.lang.String"); c = cls; } clsArr[0] = cls; this.n = clsArr; this.l = null; Class[] clsArr2 = new Class[1]; Class cls2 = b; if (cls2 == null) { cls2 = d("o.gkd"); b = cls2; } clsArr2[0] = cls2; this.q = clsArr2; ClassLoader e2 = AbstractC15217gkd.e((Class) getClass()); if (e2 == null) { str = "BOOTLOADER"; } else { try { str = e(e2); } catch (SecurityException unused) { str = GrsBaseInfo.CountryCodeSource.UNKNOWN; } } this.i = new StringBuffer("[LogFactoryImpl@").append(System.identityHashCode(this)).append(" from ").append(str).append("] ").toString(); if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("Instance created.").toString()); } } private static /* synthetic */ Class d(String str) { try { return Class.forName(str); } catch (ClassNotFoundException e2) { throw new NoClassDefFoundError(e2.getMessage()); } } @Override // o.AbstractC15217gkd public final InterfaceC15219gkf c(Class cls) throws LogConfigurationException { String name = cls.getName(); InterfaceC15219gkf interfaceC15219gkf = (InterfaceC15219gkf) this.f9141o.get(name); if (interfaceC15219gkf != null) { return interfaceC15219gkf; } InterfaceC15219gkf e2 = e(name); this.f9141o.put(name, e2); return e2; } private ClassLoader c(ClassLoader classLoader) { try { return (ClassLoader) AccessController.doPrivileged(new C15236gkw(this, classLoader)); } catch (SecurityException unused) { if (!AbstractC15217gkd.e()) { return null; } c(new StringBuffer().append(this.i).append("[SECURITY] Unable to obtain parent classloader").toString()); return null; } } private static void d(StringBuffer stringBuffer, String str, String str2) { if (!str.equals(str2) && str.regionMatches(true, 0, str2, 0, 37)) { stringBuffer.append(" Did you mean '"); stringBuffer.append(str2); stringBuffer.append("'?"); } } /* JADX WARN: Code restructure failed: missing block: B:93:0x042f, code lost: r8 = r8; */ /* JADX WARN: Removed duplicated region for block: B:159:0x05de */ /* JADX WARN: Removed duplicated region for block: B:164:0x0628 */ /* JADX WARN: Removed duplicated region for block: B:169:0x04b4 */ /* JADX WARN: Removed duplicated region for block: B:188:0x05a2 A[SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:195:0x023f A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:40:0x010c */ /* JADX WARN: Removed duplicated region for block: B:45:0x012a A[Catch: all -> 0x04a4, LogConfigurationException -> 0x05a8, ExceptionInInitializerError -> 0x05ab, NoClassDefFoundError -> 0x05f5, TRY_ENTER, TryCatch #4 {all -> 0x04a4, blocks: (B:42:0x0122, B:45:0x012a, B:47:0x0145, B:49:0x0161, B:51:0x0188, B:52:0x019f, B:54:0x01c4, B:55:0x014a, B:58:0x01db, B:59:0x0231, B:67:0x025c, B:217:0x01e2, B:219:0x0217, B:221:0x022d), top: B:41:0x0122 }] */ /* JADX WARN: Removed duplicated region for block: B:64:0x0256 A[Catch: all -> 0x0447, ExceptionInInitializerError -> 0x0450, NoClassDefFoundError -> 0x0455, LogConfigurationException -> 0x05a8, TRY_ENTER, TRY_LEAVE, TryCatch #8 {all -> 0x0447, blocks: (B:61:0x0237, B:64:0x0256, B:68:0x0262), top: B:60:0x0237 }] */ /* JADX WARN: Removed duplicated region for block: B:95:0x0598 A[LOOP:2: B:38:0x00e9->B:95:0x0598, LOOP_END] */ /* JADX WARN: Removed duplicated region for block: B:96:0x063e A[EDGE_INSN: B:96:0x063e->B:97:0x063e BREAK A[LOOP:2: B:38:0x00e9->B:95:0x0598], SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:99:0x0642 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private o.InterfaceC15219gkf a(java.lang.String r20, java.lang.String r21) throws org.apache.commons.logging.LogConfigurationException { /* Method dump skipped, instructions count: 1803 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.C15225gkl.a(java.lang.String, java.lang.String):o.gkf"); } private String a() { if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("Trying to get log class from attribute 'org.apache.commons.logging.Log'").toString()); } String str = (String) this.j.get("o.gkf"); if (str == null) { if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("Trying to get log class from attribute 'org.apache.commons.logging.log'").toString()); } str = (String) this.j.get("org.apache.commons.logging.log"); } if (str == null) { if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("Trying to get log class from system property 'org.apache.commons.logging.Log'").toString()); } try { str = (String) AccessController.doPrivileged(new C15232gks("o.gkf")); } catch (SecurityException e2) { if (AbstractC15217gkd.e()) { String obj = new StringBuffer("No access allowed to system property 'org.apache.commons.logging.Log' - ").append(e2.getMessage()).toString(); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(obj).toString()); } } } } if (str == null) { if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("Trying to get log class from system property 'org.apache.commons.logging.log'").toString()); } try { str = (String) AccessController.doPrivileged(new C15232gks("org.apache.commons.logging.log")); } catch (SecurityException e3) { if (AbstractC15217gkd.e()) { String obj2 = new StringBuffer("No access allowed to system property 'org.apache.commons.logging.log' - ").append(e3.getMessage()).toString(); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(obj2).toString()); } } } } return str != null ? str.trim() : str; } private String a(String str) { String str2; if (AbstractC15217gkd.e()) { String concat = "[ENV] Trying to get configuration for item ".concat(String.valueOf(str)); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(concat).toString()); } } Object obj = this.j.get(str); if (obj != null) { if (AbstractC15217gkd.e()) { String obj2 = new StringBuffer("[ENV] Found LogFactory attribute [").append(obj).append("] for ").append(str).toString(); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(obj2).toString()); } } return obj.toString(); } if (AbstractC15217gkd.e()) { String concat2 = "[ENV] No LogFactory attribute found for ".concat(String.valueOf(str)); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(concat2).toString()); } } try { str2 = (String) AccessController.doPrivileged(new C15232gks(str)); } catch (SecurityException unused) { if (AbstractC15217gkd.e()) { String concat3 = "[ENV] Security prevented reading system property ".concat(String.valueOf(str)); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(concat3).toString()); } } } if (str2 != null) { if (AbstractC15217gkd.e()) { String obj3 = new StringBuffer("[ENV] Found system property [").append(str2).append("] for ").append(str).toString(); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(obj3).toString()); } } return str2; } if (AbstractC15217gkd.e()) { String obj4 = new StringBuffer("[ENV] No system property found for property ").append(str).toString(); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(obj4).toString()); } } if (!AbstractC15217gkd.e()) { return null; } String concat4 = "[ENV] No configuration defined for item ".concat(String.valueOf(str)); if (!AbstractC15217gkd.e()) { return null; } c(new StringBuffer().append(this.i).append(concat4).toString()); return null; } private InterfaceC15219gkf e(String str) throws LogConfigurationException { InterfaceC15219gkf interfaceC15219gkf; try { Constructor constructor = this.k; if (constructor != null) { interfaceC15219gkf = (InterfaceC15219gkf) constructor.newInstance(str); } else { if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("Discovering a Log implementation...").toString()); } String a2 = a("org.apache.commons.logging.Log.allowFlawedContext"); boolean z = true; this.h = a2 == null ? true : Boolean.valueOf(a2).booleanValue(); String a3 = a("org.apache.commons.logging.Log.allowFlawedDiscovery"); this.f = a3 == null ? true : Boolean.valueOf(a3).booleanValue(); String a4 = a("org.apache.commons.logging.Log.allowFlawedHierarchy"); if (a4 != null) { z = Boolean.valueOf(a4).booleanValue(); } this.g = z; String a5 = a(); if (a5 != null) { if (AbstractC15217gkd.e()) { String obj = new StringBuffer("Attempting to load user-specified log class '").append(a5).append("'...").toString(); if (AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append(obj).toString()); } } interfaceC15219gkf = a(a5, str); if (interfaceC15219gkf == null) { StringBuffer stringBuffer = new StringBuffer("User-specified log class '"); stringBuffer.append(a5); stringBuffer.append("' cannot be found or is not useable."); d(stringBuffer, a5, "o.gkq"); d(stringBuffer, a5, "o.gkn"); d(stringBuffer, a5, "o.gkp"); d(stringBuffer, a5, "o.gkx"); throw new LogConfigurationException(stringBuffer.toString()); } } else { if (AbstractC15217gkd.e() && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("No user-specified Log implementation; performing discovery using the standard supported logging implementations...").toString()); } InterfaceC15219gkf interfaceC15219gkf2 = null; int i = 0; while (true) { String[] strArr = a; if (i >= strArr.length || interfaceC15219gkf2 != null) { break; } interfaceC15219gkf2 = a(strArr[i], str); i++; } if (interfaceC15219gkf2 == null) { throw new LogConfigurationException("No suitable Log implementation"); } interfaceC15219gkf = interfaceC15219gkf2; } } Method method = this.l; if (method != null) { method.invoke(interfaceC15219gkf, this); } return interfaceC15219gkf; } catch (InvocationTargetException e2) { e = e2; Throwable targetException = e.getTargetException(); if (targetException != null) { e = targetException; } throw new LogConfigurationException(e); } catch (LogConfigurationException e3) { throw e3; } catch (Throwable th) { b(th); throw new LogConfigurationException(th); } } @Override // o.AbstractC15217gkd public final void e(String str, Object obj) { if (this.k != null && AbstractC15217gkd.e()) { c(new StringBuffer().append(this.i).append("setAttribute: call too late; configuration already performed.").toString()); } if (obj == null) { this.j.remove(str); } else { this.j.put(str, obj); } if (str.equals("use_tccl")) { this.p = obj != null && Boolean.valueOf(obj.toString()).booleanValue(); } } }