小红书.apk(点击下载) / d.java


package t0;

import android.util.Log;
import java.util.HashMap;
import java.util.Map;

/* compiled from: LogFactory */
public class d {

    /* renamed from: a  reason: collision with root package name */
    public static final String f132006a = "d";

    /* renamed from: b  reason: collision with root package name */
    public static Map<String, c> f132007b = new HashMap();

    public static boolean a() {
        try {
            Class.forName("org.apache.commons.logging.LogFactory");
            return true;
        } catch (ClassNotFoundException unused) {
            return false;
        } catch (Exception e14) {
            Log.e(f132006a, e14.getMessage());
            return false;
        }
    }

    public static synchronized c b(Class cls) {
        c c14;
        synchronized (d.class) {
            c14 = c(d(cls.getSimpleName()));
        }
        return c14;
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x0032  */
    public static synchronized c c(String str) {
        c cVar;
        c cVar2;
        Exception e14;
        synchronized (d.class) {
            String d14 = d(str);
            cVar = f132007b.get(d14);
            if (cVar == null) {
                if (a()) {
                    try {
                        cVar2 = new b(d14);
                        try {
                            f132007b.put(d14, cVar2);
                        } catch (Exception e15) {
                            e14 = e15;
                        }
                    } catch (Exception e16) {
                        cVar2 = cVar;
                        e14 = e16;
                        Log.w(f132006a, "Could not create log from org.apache.commons.logging.LogFactory", e14);
                        cVar = cVar2;
                        if (cVar == null) {
                        }
                        return cVar;
                    }
                    cVar = cVar2;
                }
                if (cVar == null) {
                    cVar = new a(d14);
                    f132007b.put(d14, cVar);
                }
            }
        }
        return cVar;
    }

    public static String d(String str) {
        if (str.length() <= 23) {
            return str;
        }
        if (a()) {
            new b(f132006a).g("Truncating log tag length as it exceed 23, the limit imposed by Android on certain API Levels");
        } else {
            Log.w(f132006a, "Truncating log tag length as it exceed 23, the limit imposed by Android on certain API Levels");
        }
        return str.substring(0, 23);
    }
}