/*
 * Decompiled with CFR 0.152.
 */
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;

public final class oi
extends TimerTask {
    private static Timer a = new Timer();
    private int b;
    private String c;
    private String[][] d;
    private byte[] e;
    private boolean f;
    private int g;
    private Vector h = new Vector();
    private Vector i = new Vector();
    private String j;
    private df k;
    private px l;
    private OutputStream m;
    private InputStream n;

    public static oi a(String string, String[][] stringArray, byte[] byArray, String string2, df df2) {
        oi oi2 = new oi(string, stringArray, byArray, string2, df2, true);
        a.schedule((TimerTask)oi2, 0L);
        return oi2;
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private void c() {
        if (this.n != null) {
            try {
                this.n.close();
            }
            catch (Throwable throwable) {
                throwable.printStackTrace();
            }
            this.n = null;
        }
        if (this.m != null) {
            try {
                this.m.close();
            }
            catch (Throwable throwable) {
                throwable.printStackTrace();
            }
            this.m = null;
        }
        if (this.l != null) {
            try {
                this.l.f();
            }
            catch (Throwable throwable) {
                throwable.printStackTrace();
            }
            this.l = null;
        }
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public final void run() {
        String string = !this.f ? "http://" : "https://";
        try {
            this.b = 1;
            px px2 = lh.k().e();
            string = string + this.c;
            int n = this.e == null ? 0 : 1;
            this.l = px2.a(string, n != 0);
            this.c = null;
            this.b = 2;
            if (this.e != null) {
                if (!this.f) {
                    this.l.a("Content-Type", "application/binary");
                } else {
                    this.l.a("content-type", "application/x-www-form-urlencoded");
                }
                string = Integer.toString(this.e.length);
                this.l.a("Content-Length", string);
            }
            this.b = 3;
            this.m = this.l.a();
            if (this.e != null) {
                this.m.write(this.e);
                this.e = null;
            }
            this.b = 4;
            this.g = this.l.d();
            n = 0;
            this.b = 5;
            while ((string = this.l.a(n)) != null) {
                this.h.addElement(string);
                this.i.addElement(this.l.b(n));
                ++n;
            }
            this.b = 6;
            this.n = this.l.b();
            if (this.k != null) {
                am am2 = new am(this.n);
                this.b();
                try {
                    this.k.a(this.j, am2);
                }
                catch (RuntimeException runtimeException) {
                    me.a("HttpRequest caught exception from data handler", runtimeException);
                    runtimeException.printStackTrace();
                }
            } else {
                ar.a(this.n);
            }
            this.b = 8;
            this.c();
            return;
        }
        catch (Throwable throwable) {
            try {
                df df2 = this.k;
                string = this.j;
                this.b();
                df2.d(string);
                return;
            }
            catch (Throwable throwable2) {
                try {
                    throwable2.printStackTrace();
                    return;
                }
                finally {
                    this.c();
                }
            }
        }
    }

    private oi(String string, String[][] stringArray, byte[] byArray, String string2, df df2, boolean bl2) {
        this.c = string;
        this.d = stringArray;
        this.e = byArray;
        this.j = string2;
        this.k = df2;
        this.f = bl2;
    }

    private Object[] b() {
        return new Object[]{new Integer(this.b), new Integer(this.g), this.h, this.i};
    }
}

