package m6; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.LinkedBlockingQueue; import org.slf4j.helpers.a; import org.slf4j.helpers.d; import org.slf4j.helpers.e; import org.slf4j.impl.StaticLoggerBinder; public final class c { /* renamed from: a reason: collision with root package name */ static volatile int f9756a; /* renamed from: b reason: collision with root package name */ static final d f9757b = new d(); /* renamed from: c reason: collision with root package name */ static final a f9758c = new a(); /* renamed from: d reason: collision with root package name */ static boolean f9759d = e.f("slf4j.detectLoggerNameMismatch"); /* renamed from: e reason: collision with root package name */ private static final String[] f9760e = {"1.6", "1.7"}; /* renamed from: f reason: collision with root package name */ private static String f9761f = "org/slf4j/impl/StaticLoggerBinder.class"; private c() { } private static final void a() { Set<URL> set = null; try { if (!l()) { set = f(); s(set); } StaticLoggerBinder.getSingleton(); f9756a = 3; r(set); g(); p(); f9757b.b(); } catch (NoClassDefFoundError e7) { if (m(e7.getMessage())) { f9756a = 4; e.c("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\"."); e.c("Defaulting to no-operation (NOP) logger implementation"); e.c("See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details."); return; } e(e7); throw e7; } catch (NoSuchMethodError e8) { String message = e8.getMessage(); if (message != null && message.contains("org.slf4j.impl.StaticLoggerBinder.getSingleton()")) { f9756a = 2; e.c("slf4j-api 1.6.x (or later) is incompatible with this binding."); e.c("Your binding is version 1.5.5 or earlier."); e.c("Upgrade your binding to version 1.6.x."); } throw e8; } catch (Exception e9) { e(e9); throw new IllegalStateException("Unexpected initialization failure", e9); } } private static void b(n6.c cVar, int i7) { if (cVar.a().c()) { c(i7); } else if (!cVar.a().d()) { d(); } } private static void c(int i7) { e.c("A number (" + i7 + ") of logging calls during the initialization phase have been intercepted and are"); e.c("now being replayed. These are subject to the filtering rules of the underlying logging system."); e.c("See also http://www.slf4j.org/codes.html#replay"); } private static void d() { e.c("The following set of substitute loggers may have been accessed"); e.c("during the initialization phase. Logging calls during this"); e.c("phase were not honored. However, subsequent logging calls to these"); e.c("loggers will work as normally expected."); e.c("See also http://www.slf4j.org/codes.html#substituteLogger"); } static void e(Throwable th) { f9756a = 2; e.d("Failed to instantiate SLF4J LoggerFactory", th); } static Set<URL> f() { Enumeration<URL> enumeration; LinkedHashSet linkedHashSet = new LinkedHashSet(); try { ClassLoader classLoader = c.class.getClassLoader(); if (classLoader == null) { enumeration = ClassLoader.getSystemResources(f9761f); } else { enumeration = classLoader.getResources(f9761f); } while (enumeration.hasMoreElements()) { linkedHashSet.add(enumeration.nextElement()); } } catch (IOException e7) { e.d("Error getting resources from path", e7); } return linkedHashSet; } private static void g() { d dVar = f9757b; synchronized (dVar) { dVar.e(); for (org.slf4j.helpers.c cVar : dVar.d()) { cVar.g(j(cVar.getName())); } } } public static a h() { if (f9756a == 0) { synchronized (c.class) { if (f9756a == 0) { f9756a = 1; o(); } } } int i7 = f9756a; if (i7 == 1) { return f9757b; } if (i7 == 2) { throw new IllegalStateException("org.slf4j.LoggerFactory in failed state. Original exception was thrown EARLIER. See also http://www.slf4j.org/codes.html#unsuccessfulInit"); } else if (i7 == 3) { return StaticLoggerBinder.getSingleton().getLoggerFactory(); } else { if (i7 == 4) { return f9758c; } throw new IllegalStateException("Unreachable code"); } } public static b i(Class<?> cls) { Class<?> a7; b j7 = j(cls.getName()); if (f9759d && (a7 = e.a()) != null && n(cls, a7)) { e.c(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", j7.getName(), a7.getName())); e.c("See http://www.slf4j.org/codes.html#loggerNameMismatch for an explanation"); } return j7; } public static b j(String str) { return h().a(str); } private static boolean k(Set<URL> set) { return set.size() > 1; } private static boolean l() { String g7 = e.g("java.vendor.url"); if (g7 == null) { return false; } return g7.toLowerCase().contains("android"); } private static boolean m(String str) { if (str == null) { return false; } return str.contains("org/slf4j/impl/StaticLoggerBinder") || str.contains("org.slf4j.impl.StaticLoggerBinder"); } private static boolean n(Class<?> cls, Class<?> cls2) { return !cls2.isAssignableFrom(cls); } private static final void o() { a(); if (f9756a == 3) { t(); } } private static void p() { LinkedBlockingQueue<n6.c> c7 = f9757b.c(); int size = c7.size(); ArrayList<n6.c> arrayList = new ArrayList(128); int i7 = 0; while (c7.drainTo(arrayList, 128) != 0) { for (n6.c cVar : arrayList) { q(cVar); int i8 = i7 + 1; if (i7 == 0) { b(cVar, size); } i7 = i8; } arrayList.clear(); } } private static void q(n6.c cVar) { if (cVar != null) { org.slf4j.helpers.c a7 = cVar.a(); String name = a7.getName(); if (a7.e()) { throw new IllegalStateException("Delegate logger cannot be null at this state."); } else if (!a7.d()) { if (a7.c()) { a7.f(cVar); } else { e.c(name); } } } } private static void r(Set<URL> set) { if (set != null && k(set)) { e.c("Actual binding is of type [" + StaticLoggerBinder.getSingleton().getLoggerFactoryClassStr() + "]"); } } private static void s(Set<URL> set) { if (k(set)) { e.c("Class path contains multiple SLF4J bindings."); Iterator<URL> it = set.iterator(); while (it.hasNext()) { e.c("Found binding in [" + it.next() + "]"); } e.c("See http://www.slf4j.org/codes.html#multiple_bindings for an explanation."); } } private static final void t() { try { String str = StaticLoggerBinder.REQUESTED_API_VERSION; boolean z6 = false; for (String str2 : f9760e) { if (str.startsWith(str2)) { z6 = true; } } if (!z6) { e.c("The requested version " + str + " by your slf4j binding is not compatible with " + Arrays.asList(f9760e).toString()); e.c("See http://www.slf4j.org/codes.html#version_mismatch for further details."); } } catch (NoSuchFieldError unused) { } catch (Throwable th) { e.d("Unexpected problem occured during version sanity check", th); } } }