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


package a13;

import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/* compiled from: NestableDelegate */
public class c implements Serializable {

    /* renamed from: b  reason: collision with root package name */
    public static boolean f1390b = true;

    /* renamed from: c  reason: collision with root package name */
    public static boolean f1391c = true;

    /* renamed from: d  reason: collision with root package name */
    public static boolean f1392d = true;

    /* renamed from: e  reason: collision with root package name */
    public static /* synthetic */ Class f1393e = null;
    private static final long serialVersionUID = 1;

    /* renamed from: a  reason: collision with root package name */
    public Throwable f1394a = null;

    public c(b bVar) {
        if (bVar instanceof Throwable) {
            this.f1394a = (Throwable) bVar;
            return;
        }
        throw new IllegalArgumentException("The Nestable implementation passed to the NestableDelegate(Nestable) constructor must extend java.lang.Throwable");
    }

    public static /* synthetic */ Class a(String str) {
        try {
            return Class.forName(str);
        } catch (ClassNotFoundException e14) {
            throw new NoClassDefFoundError(e14.getMessage());
        }
    }

    public String b(int i10) {
        Throwable e14 = e(i10);
        Class cls = f1393e;
        if (cls == null) {
            cls = a("org.apache.commons.lang.exception.Nestable");
            f1393e = cls;
        }
        if (cls.isInstance(e14)) {
            return ((b) e14).getMessage(0);
        }
        return e14.getMessage();
    }

    public String[] c() {
        Throwable[] g10 = g();
        String[] strArr = new String[g10.length];
        for (int i10 = 0; i10 < g10.length; i10++) {
            Class cls = f1393e;
            if (cls == null) {
                cls = a("org.apache.commons.lang.exception.Nestable");
                f1393e = cls;
            }
            strArr[i10] = cls.isInstance(g10[i10]) ? ((b) g10[i10]).getMessage(0) : g10[i10].getMessage();
        }
        return strArr;
    }

    public String[] d(Throwable th3) {
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter((Writer) stringWriter, true);
        if (th3 instanceof b) {
            ((b) th3).printPartialStackTrace(printWriter);
        } else {
            th3.printStackTrace(printWriter);
        }
        return a.g(stringWriter.getBuffer().toString());
    }

    public Throwable e(int i10) {
        if (i10 == 0) {
            return this.f1394a;
        }
        return g()[i10];
    }

    public int f() {
        return a.h(this.f1394a);
    }

    public Throwable[] g() {
        return a.j(this.f1394a);
    }

    public int h(Class cls, int i10) {
        if (cls == null) {
            return -1;
        }
        if (i10 >= 0) {
            Throwable[] j14 = a.j(this.f1394a);
            if (i10 < j14.length) {
                if (f1392d) {
                    while (i10 < j14.length) {
                        if (cls.isAssignableFrom(j14[i10].getClass())) {
                            return i10;
                        }
                        i10++;
                    }
                } else {
                    while (i10 < j14.length) {
                        if (cls.equals(j14[i10].getClass())) {
                            return i10;
                        }
                        i10++;
                    }
                }
                return -1;
            }
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append("The start index was out of bounds: ");
            stringBuffer.append(i10);
            stringBuffer.append(" >= ");
            stringBuffer.append(j14.length);
            throw new IndexOutOfBoundsException(stringBuffer.toString());
        }
        StringBuffer stringBuffer2 = new StringBuffer();
        stringBuffer2.append("The start index was out of bounds: ");
        stringBuffer2.append(i10);
        throw new IndexOutOfBoundsException(stringBuffer2.toString());
    }

    public void i() {
        j(System.err);
    }

    public void j(PrintStream printStream) {
        synchronized (printStream) {
            PrintWriter printWriter = new PrintWriter((OutputStream) printStream, false);
            k(printWriter);
            printWriter.flush();
        }
    }

    public void k(PrintWriter printWriter) {
        Throwable th3 = this.f1394a;
        if (!a.k()) {
            ArrayList arrayList = new ArrayList();
            while (th3 != null) {
                arrayList.add(d(th3));
                th3 = a.b(th3);
            }
            String str = "Caused by: ";
            if (!f1390b) {
                str = "Rethrown as: ";
                Collections.reverse(arrayList);
            }
            if (f1391c) {
                l(arrayList);
            }
            synchronized (printWriter) {
                Iterator it3 = arrayList.iterator();
                while (it3.hasNext()) {
                    for (String str2 : (String[]) it3.next()) {
                        printWriter.println(str2);
                    }
                    if (it3.hasNext()) {
                        printWriter.print(str);
                    }
                }
            }
        } else if (th3 instanceof b) {
            ((b) th3).printPartialStackTrace(printWriter);
        } else {
            th3.printStackTrace(printWriter);
        }
    }

    public void l(List list) {
        for (int size = list.size() - 1; size > 0; size--) {
            String[] strArr = (String[]) list.get(size);
            ArrayList arrayList = new ArrayList(Arrays.asList(strArr));
            a.l(arrayList, new ArrayList(Arrays.asList((String[]) list.get(size - 1))));
            int length = strArr.length - arrayList.size();
            if (length > 0) {
                StringBuffer stringBuffer = new StringBuffer();
                stringBuffer.append("\t... ");
                stringBuffer.append(length);
                stringBuffer.append(" more");
                arrayList.add(stringBuffer.toString());
                list.set(size, arrayList.toArray(new String[arrayList.size()]));
            }
        }
    }
}