QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 WUPTask.java 源代码,内容仅作参考


package com.tencent.common.wup;

import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.ValueCallback;
import com.taf.HexUtil;
import com.tencent.basesupport.FLogger;
import com.tencent.basesupport.qbopentelemetryproxy.IQBSpanProxy;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.http.Apn;
import com.tencent.common.http.HttpHeader;
import com.tencent.common.http.HttpTimeRecord;
import com.tencent.common.http.IRequstIntercepter;
import com.tencent.common.http.MttInputStream;
import com.tencent.common.http.MttRequestBase;
import com.tencent.common.http.MttResponse;
import com.tencent.common.http.NetUtils;
import com.tencent.common.http.RequesterFactory;
import com.tencent.common.http.moniter.INetEvent;
import com.tencent.common.http.moniter.INetEventGroup;
import com.tencent.common.http.moniter.NetEvent;
import com.tencent.common.http.moniter.NetEventMonitor;
import com.tencent.common.serverconfig.DnsManager;
import com.tencent.common.serverconfig.IPListUtils;
import com.tencent.common.serverconfig.WupProxyDomainRouter;
import com.tencent.common.serverconfig.WupServerConfigsWrapper;
import com.tencent.common.utils.FileUtilsF;
import com.tencent.common.utils.HttpsUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.common.wup.base.MttWupRequest;
import com.tencent.common.wup.base.WupConnectionPool;
import com.tencent.common.wup.base.WupTimeOutController;
import com.tencent.common.wup.interfaces.IWUPClientProxy;
import com.tencent.common.wup.security.MttTokenProvider;
import com.tencent.common.wup.security.MttWupToken;
import com.tencent.common.wup.security.WupEncryptHelper;
import com.tencent.midas.api.APMidasPayAPI;
import com.tencent.mtt.AppInfoHolder;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.apkplugin.impl.IAPInjectService;
import com.tencent.mtt.base.net.frame.ByteArrayPool;
import com.tencent.mtt.base.net.frame.PoolingByteArrayOutputStream;
import com.tencent.mtt.base.task.Task;
import com.tencent.mtt.twsdk.log.Logs;
import com.tencent.mtt.twsdk.qbinfo.TWSettingManager;
import com.tencent.wup.BuildConfig;
import com.xiaomi.mipush.sdk.Constants;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.ProtocolException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

public class WUPTask extends Task implements IRequstIntercepter {
    public static final String BACKGROUND_TASK = "BACKGROUND_TASK";
    private static boolean E = Log.isLoggable("CapMock", 3);
    public static final String EMERGENCY_TASK = "EMERGENCY_TASK";
    public static final int TOKEN_ERROR_RETRY_TIMES = 3;
    private WUPTaskClient A;
    private IWUPClientProxy B;
    private boolean I;
    private boolean J;

    private byte[] f10414b;

    private byte[] f10415c;
    private String e;
    private Object f;
    private boolean i;
    public int mRespDataType;
    private String s;

    private int f10413a = 0;

    private boolean f10416d = false;
    private boolean g = false;
    private boolean h = false;
    private boolean j = true;
    private int k = 1;
    public ArrayList<String> mStatPath = new ArrayList<>();
    private boolean l = false;
    private byte[] m = null;
    private DnsManager.DnsData n = null;
    private String o = null;
    private MttWupToken p = null;
    private String q = null;
    private boolean r = false;
    private byte t = 0;
    private String u = null;
    private boolean v = false;
    private RequestPolicy w = RequestPolicy.MAX_RETRY_POLICY;
    private int x = 2;
    private boolean y = false;
    private boolean z = false;
    private IQBSpanProxy C = null;
    private WupTimeOutController D = WupTimeOutController.a();
    private boolean F = false;
    private int G = -1;
    private String H = "-1";

    public WUPTask(byte[] bArr, int i, String str, boolean z, boolean z2, Boolean bool, WUPTaskClient wUPTaskClient) {
        this.i = false;
        this.s = "";
        this.A = null;
        this.B = null;
        this.i = z2;
        this.A = wUPTaskClient;
        this.s = str;
        this.B = this.A.a();
        a(bArr, i, z, bool);
    }

    private void a() {
        if (this.mErrorCode > -2001 || this.mErrorCode < -2009) {
            this.D.i();
            return;
        }
        this.D.h();
        DnsManager.DnsData dnsData = this.n;
        if (dnsData != null) {
            FLogger.d("DnsManager", "Increase FailTime for " + dnsData);
            dnsData.g = dnsData.g + 1;
        }
    }

    private void a(int i) {
        if (i == 1 && this.J) {
            this.I = true;
        } else if (WUPProxyHolder.getPublicWUPProxy() != null) {
            this.I = IWUPClientProxy.isHttp2Enable();
        }
    }

    private void a(int i, Boolean bool) {
        if (i == 1 && bool.booleanValue()) {
            this.J = true;
        }
    }

    private void a(int i, boolean z) {
        StringBuilder sb = new StringBuilder();
        sb.append("serverName=");
        sb.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
        sb.append("funcName=");
        sb.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
        sb.append(" mUrl=");
        sb.append(this.e);
        sb.append(" uniqueId=");
        sb.append(this.G);
        sb.append(" traceId=");
        sb.append(this.H);
        sb.append(" retryTimes=");
        sb.append((getBindObject() == null || !(getBindObject() instanceof WUPRequestBase)) ? IAPInjectService.EP_NULL : Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()));
        sb.append(" statusCode=");
        sb.append(i);
        Logs.d("wupResult", sb.toString());
    }

    private void a(long j) {
        if (this.sendTime == -1 || j - this.sendTime <= 500 || this.mMttRequest.getServerName() == null || this.mMttRequest.getFuncName() == null) {
            return;
        }
        Logs.d("wupRequest", "serverName=" + this.mMttRequest.getServerName() + " funcName=" + this.mMttRequest.getFuncName() + " thread wait time=" + (j - this.sendTime));
    }

    private void a(long j, long j2) {
        long currentTimeMillis = System.currentTimeMillis() - j;
        int i = this.G;
        int i2 = this.f10413a;
        HttpTimeRecord.record(i, HttpTimeRecord.WUP_CURRENT_TASK_TOTAL_TIME, i2, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null, this.o, this.e, "execute cost total " + String.valueOf(currentTimeMillis) + ", handleResponseCost " + String.valueOf(j2));
    }

    private void a(Apn.ApnInfo apnInfo) {
        if (apnInfo != null) {
            NetEventMonitor.getInstance().group(this.G).setApnType(apnInfo.getApnType());
        }
    }

    private void a(MttRequestBase mttRequestBase) {
        this.H = "" + System.currentTimeMillis();
        mttRequestBase.addHeader("Traceid", this.H);
    }

    private void a(MttResponse mttResponse) {
        HashMap<String, String> peformanceData = this.mRequester.getPeformanceData();
        if (peformanceData != null) {
            NetEventMonitor.getInstance().group(this.G).setPerformanceData(peformanceData);
            NetEventMonitor.getInstance().group(this.G).setCronetErrorCode(mttResponse.getCronetErrorCode());
            NetEventMonitor.getInstance().group(this.G).setCronetDetailErrorCode(mttResponse.getCronetDetailErrorCode());
        }
    }

    public void a(MttResponse mttResponse, long j) {
        boolean z;
        Boolean valueOf = Boolean.valueOf(!UrlUtils.isIpv6Url(this.e));
        try {
            NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_do_request_end").build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
            HttpTimeRecord.record(this.G, "wup_request_do_request_end", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
            this.mStatPath.add("wten");
            this.mNetworkStatus = this.mMttRequest.mNetworkStatus;
            setMttResponse(mttResponse);
            k();
            int intValue = mttResponse.getStatusCode().intValue();
            this.mStatPath.add("wtsc_" + intValue);
            if (intValue == 200) {
                b(mttResponse);
                a((Boolean) true, j);
                a(intValue, false);
                if (z) {
                    return;
                } else {
                    return;
                }
            }
            if (intValue < 700 || intValue > 702) {
                a(intValue, true);
                this.mErrorCode = -2001;
                if (this.mRequester != null) {
                    this.mRequester.close();
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - j));
            } else {
                b(intValue);
                try {
                    a((Boolean) true, j);
                    a(intValue, true);
                    if (this.mRequester != null) {
                        this.mRequester.close();
                    }
                    this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - j));
                    if (this.y) {
                        return;
                    }
                    this.D.a(System.currentTimeMillis() - j);
                } catch (Throwable th) {
                    valueOf = false;
                    th = th;
                    try {
                        b(th);
                        if (this.mRequester != null) {
                            this.mRequester.close();
                        }
                        this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - j));
                    } finally {
                        if (this.mRequester != null) {
                            this.mRequester.close();
                        }
                        this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - j));
                        if (!this.y) {
                            this.D.a(System.currentTimeMillis() - j);
                        }
                    }
                }
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private void a(Boolean bool, long j) {
        if (!bool.booleanValue()) {
            this.f10413a++;
            if (this.f10413a < this.x) {
                this.mRunningState = (byte) 3;
            }
        }
        if (this.f10416d) {
            this.mStatus = (byte) 6;
        }
        if (this.mRunningState != 3) {
            this.mStatPath.add("wtd");
            this.mRunningState = (byte) 2;
        }
        long j2 = -1;
        if (isRetring()) {
            retry();
        } else {
            long currentTimeMillis = System.currentTimeMillis();
            HttpTimeRecord.record(this.G, "wup_request_handle_response_start", this.f10413a, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null, this.o, this.e);
            handleResponse();
            j2 = System.currentTimeMillis() - currentTimeMillis;
        }
        a(j, j2);
    }

    private void a(String str, int i, String str2) {
        int i2 = this.G;
        HttpTimeRecord.record(i2, str, -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null, "errorCode:" + i + ",stack:" + str2);
    }

    private void a(String str, Throwable th) {
        String str2;
        if (th == null || TextUtils.isEmpty(str)) {
            return;
        }
        String str3 = new String();
        try {
            str2 = th.getMessage();
            for (int i = 1; i < th.getStackTrace().length; i++) {
                try {
                    str3 = str3 + "\\" + th.getStackTrace()[i];
                } catch (Throwable unused) {
                }
            }
        } catch (Throwable unused2) {
            str2 = "";
        }
        if (TextUtils.isEmpty(str3)) {
            return;
        }
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("wup_err_code", str);
        hashMap.put("wup_err_stack", str3);
        hashMap.put("wup_err_msg", str2);
        this.B.reportStatInfo("WUP_EXCEPTION_INFO", hashMap);
    }

    private void a(Throwable th) {
        StringBuilder sb = new StringBuilder();
        sb.append("serverName=");
        sb.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
        sb.append("funcName=");
        sb.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
        sb.append(" mUrl=");
        sb.append(this.e);
        sb.append(" uniqueId=");
        sb.append(this.G);
        sb.append(" traceId=");
        sb.append(this.H);
        sb.append(" retryTimes=");
        sb.append((getBindObject() == null || !(getBindObject() instanceof WUPRequestBase)) ? IAPInjectService.EP_NULL : Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()));
        sb.append(" exception=");
        sb.append(th);
        Logs.d("wupError", sb.toString());
        IQBSpanProxy iQBSpanProxy = this.C;
        if (iQBSpanProxy != null) {
            iQBSpanProxy.recordException(th);
        }
    }

    private void a(Throwable th, boolean z) {
        String str;
        FLogger.d("CeasonTestWUP", " WUP Encryption failed, error=" + th.getMessage());
        this.q = "";
        if (z) {
            this.A.c().b();
            str = "oaep_enc_fail";
        } else {
            str = "rsa_enc_fail";
        }
        a(str, th);
    }

    private void a(byte[] bArr) {
        ByteArrayOutputStream byteArrayOutputStream;
        byte[] bArr2 = null;
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
        } catch (Throwable th) {
            th = th;
            byteArrayOutputStream = null;
        }
        try {
            GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
            gZIPOutputStream.write(bArr);
            gZIPOutputStream.finish();
            gZIPOutputStream.close();
            bArr2 = byteArrayOutputStream.toByteArray();
        } catch (Throwable th2) {
            th = th2;
            try {
                FLogger.d("WUPTask", "gzip request failed: err = " + th.getMessage());
            } catch (Throwable th3) {
                if (byteArrayOutputStream != null) {
                    try {
                        byteArrayOutputStream.close();
                    } catch (Throwable unused) {
                    }
                }
                throw th3;
            }
        }
        try {
            byteArrayOutputStream.close();
        } catch (Throwable unused2) {
        }
        if (bArr2 != null) {
            this.f10415c = bArr2;
            this.mMttRequest.addHeader("QQ-S-ZIP", "gzip");
        }
    }

    private void a(byte[] bArr, int i, boolean z, Boolean bool) {
        a(i, bool);
        a(i);
        this.f10415c = bArr;
        this.mMttRequest = new MttWupRequest();
        this.mMttRequest.setQueenProxyEnable(false);
        this.mMttRequest.setHttp2Enable(this.I);
        this.mMttRequest.setIsWupRequest(true);
        this.mMttRequest.setSslSocketFactory(HttpsUtils.b());
        this.mMttRequest.setRequestType(MttRequestBase.REQUEST_WUP);
        this.mMttRequest.setHostVerifier(WupHostnameVerifier.INSTANCE);
        if (this.j) {
            this.mMttRequest.replaceHeader("User-Agent", "MQQBrowser");
            this.mMttRequest.replaceHeader("Accept", "*/*");
        }
        this.mMttRequest.addHeader("Content-Type", "application/multipart-formdata");
        if (i == 1) {
            this.mMttRequest.addHeader("PB", String.valueOf(1));
        }
        if (!TextUtils.isEmpty(this.s)) {
            this.mMttRequest.addHeader(HttpHeader.REQ.QEXTINFO, this.s);
        }
        String strGuid = this.B.getStrGuid();
        FLogger.d("WUPTask", "guid: " + strGuid);
        String qua = this.B.getQUA(false);
        String qua2_v3 = this.B.getQUA2_V3();
        if (qua != null) {
            this.mMttRequest.addHeader(HttpHeader.REQ.QUA, qua);
        }
        if (qua2_v3 != null) {
            this.mMttRequest.addHeader(HttpHeader.REQ.QUA2, qua2_v3);
        }
        if (strGuid != null) {
            this.mMttRequest.addHeader(HttpHeader.REQ.QGUID, strGuid);
        }
        String appInfoByID = AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_QIMEI_FORHTTPHEADER);
        if (!TextUtils.isEmpty(appInfoByID)) {
            this.mMttRequest.addHeader(HttpHeader.REQ.Q_QIMEI, appInfoByID);
        }
        String appInfoByID2 = AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_QIMEI36_FORHTTPHEADER);
        if (!TextUtils.isEmpty(appInfoByID2)) {
            this.mMttRequest.addHeader(HttpHeader.REQ.QIMEI36, appInfoByID2);
        }
        this.mMttRequest.setMethod((byte) 1);
        this.r = z;
    }

    private byte[] a(InputStream inputStream, MttResponse mttResponse) throws OutOfMemoryError, IOException {
        ByteArrayPool a2 = ByteArrayPool.a();
        if (a2 == null) {
            ByteBuffer a3 = FileUtilsF.a(inputStream);
            byte[] bArr = new byte[a3.position()];
            a3.position(0);
            a3.get(bArr);
            FileUtilsF.f().a(a3);
            return bArr;
        }
        PoolingByteArrayOutputStream poolingByteArrayOutputStream = new PoolingByteArrayOutputStream(a2, (int) mttResponse.getContentLength());
        byte[] bArr2 = null;
        try {
            bArr2 = a2.a(2048);
            while (true) {
                int read = inputStream.read(bArr2);
                if (read == -1) {
                    return poolingByteArrayOutputStream.toByteArray();
                }
                poolingByteArrayOutputStream.write(bArr2, 0, read);
            }
        } finally {
            a2.a(bArr2);
            poolingByteArrayOutputStream.close();
        }
    }

    private void b() {
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event(INetEvent.WUP_TASK_THREAD_WAIT_TIME).build()).group(this.G).setTaskThreadWaitTime(this.mThreadWaitTime);
    }

    private void b(int i) {
        HttpTimeRecord.record(this.G, HttpTimeRecord.WUP_REQUEST_HTTP_FAILED_START, -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event(INetEvent.WUP_REQUEST_HTTP_ERROR_START).code(WUPConst.WUP_E_CODE_SERVER_DECRYPT_ERROR).build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        this.mErrorCode = WUPConst.WUP_E_CODE_SERVER_DECRYPT_ERROR;
        String str = "server_dec_error_" + i;
        StringBuilder sb = new StringBuilder();
        sb.append("Current Padding is ");
        sb.append((int) this.t);
        sb.append(", is using token? ");
        MttWupToken mttWupToken = this.p;
        sb.append((mttWupToken == null || TextUtils.isEmpty(mttWupToken.f10478a)) ? false : true);
        a(str, new Throwable(sb.toString()));
        if (this.t == 2 && i == 702) {
            this.A.c().b();
        }
        MttWupToken mttWupToken2 = this.p;
        if (mttWupToken2 != null) {
            mttWupToken2.a(true);
        }
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event(INetEvent.WUP_REQUEST_HTTP_ERROR_END).code(WUPConst.WUP_E_CODE_SERVER_DECRYPT_ERROR).build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setThreadPerformEndTime(SystemClock.currentThreadTimeMillis()).setServerName(this.mMttRequest.getServerName());
        HttpTimeRecord.record(this.G, HttpTimeRecord.WUP_REQUEST_HTTP_FAILED_END, -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
    }

    private void b(long j) {
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event(INetEvent.WUP_REQUEST_TASK_END).build()).group(this.G).setWupRequestTaskTime(System.currentTimeMillis() - j);
    }

    private void b(MttResponse mttResponse) throws IOException {
        HttpTimeRecord.record(this.G, "wup_request_http_success_start", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_http_success_start").build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        c(mttResponse);
        MttInputStream inputStream = mttResponse.getInputStream();
        if (inputStream != null) {
            this.f10414b = a(inputStream, mttResponse);
            byte[] bArr = this.f10414b;
            if (bArr != null) {
                mttResponse.setFlow(bArr.length);
            }
        } else {
            this.mStatPath.add("wtei");
        }
        this.mStatPath.add("wtno");
        this.mStatus = (byte) 3;
        NetEvent build = NetEvent.newBuilder().event("wup_request_http_success_end").build();
        IQBSpanProxy iQBSpanProxy = this.C;
        if (iQBSpanProxy != null) {
            iQBSpanProxy.addEvent("WUP_REQUEST_HTTP_SUCCESS_END");
        }
        a(mttResponse);
        NetEventMonitor.getInstance().stat(this.G, build).group(this.G).setThreadPerformEndTime(SystemClock.currentThreadTimeMillis()).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        HttpTimeRecord.record(this.G, "wup_request_http_success_end", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        if (this.y) {
            return;
        }
        a();
    }

    private void b(Throwable th) {
        int i;
        if (th instanceof UnknownHostException) {
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_NET_UNKNOWN_HOST_EXCEPTION;
        } else if (th instanceof ProtocolException) {
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_PROTOCAL_ERROR;
        } else if (th instanceof ConnectException) {
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_NET_CONN_EXCEPTION;
        } else if (th instanceof SocketException) {
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_NET_SOCKET_EXCEPTION;
        } else if (th instanceof SocketTimeoutException) {
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_NET_SOCKET_TIME_OUT_EXCEPTION;
        } else if (th instanceof IOException) {
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_NET_IO_EXCEPTION;
        } else {
            if ((th instanceof Exception) || !(th instanceof OutOfMemoryError)) {
                a(th);
                this.mFailedReason = th;
                this.mStatPath.add("wtme");
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                return;
            }
            a(th);
            this.mFailedReason = th;
            this.mStatPath.add("wtme");
            i = WUPConst.WUP_E_CODE_NET_OOM;
        }
        this.mErrorCode = i;
    }

    private void b(byte[] bArr) {
        byte[] bArr2;
        MttWupToken mttWupToken;
        byte a2 = this.A.c().a();
        byte[] bArr3 = null;
        if (a2 == 2) {
            try {
                this.u = WupEncryptHelper.a();
            } catch (Throwable th) {
                this.u = null;
                a("aes_enc_fail", th);
                bArr2 = null;
            }
        }
        this.p = MttTokenProvider.a().b();
        bArr2 = this.p.a(bArr, this.u);
        bArr3 = this.p.a(this.B.getByteGuid(), this.u);
        if (bArr2 == null || bArr3 == null || (mttWupToken = this.p) == null) {
            return;
        }
        boolean z = false;
        try {
            this.q = mttWupToken.a(a2, this.u);
            if (TextUtils.isEmpty(this.q)) {
                return;
            }
            this.mMttRequest.addHeader(HttpHeader.REQ.QGUID, HexUtil.bytes2HexStr(bArr3));
            String appInfoByID = AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_QIMEI_FORHTTPHEADER);
            if (!TextUtils.isEmpty(appInfoByID)) {
                this.mMttRequest.addHeader(HttpHeader.REQ.Q_QIMEI, appInfoByID);
            }
            String appInfoByID2 = AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_QIMEI36_FORHTTPHEADER);
            if (!TextUtils.isEmpty(appInfoByID2)) {
                this.mMttRequest.addHeader(HttpHeader.REQ.QIMEI36, appInfoByID2);
            }
            this.f10415c = bArr2;
            this.t = a2;
        } catch (Exception e) {
            e = e;
            if (a2 == 2) {
                z = true;
            }
            a(e, z);
        } catch (Throwable th2) {
            e = th2;
            a(e, z);
        }
    }

    private String c(Throwable th) {
        StackTraceElement[] stackTrace;
        String str;
        if (th == null || (stackTrace = th.getStackTrace()) == null || stackTrace.length < 3) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        sb.append("(msg(");
        if (TextUtils.isEmpty(th.getMessage())) {
            str = "";
        } else {
            str = th.getMessage() + ")";
        }
        sb.append(str);
        sb.append(stackTrace[0] == null ? "" : stackTrace[0].toString());
        sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
        sb.append(stackTrace[1] == null ? "" : stackTrace[1].toString());
        sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
        sb.append(stackTrace[2] != null ? stackTrace[2].toString() : "");
        return sb.toString();
    }

    private void c() {
        String a2;
        this.mThreadWaitTime = System.currentTimeMillis() - this.mThreadWaitTime;
        b();
        if (this.w == RequestPolicy.NO_RETRY_POLICY || this.w == RequestPolicy.FAST_MODE_POLICY) {
            this.x = 1;
        }
        this.y = this.w == RequestPolicy.FAST_MODE_POLICY;
        if (this.J && this.mMttRequest.getServerName() != null && this.mMttRequest.getFuncName() != null) {
            Logs.d("wupRequest", "PB prepareRequest " + this.mMttRequest.getServerName() + " - " + this.mMttRequest.getFuncName());
            this.e = "https://trpcpb.imtt.qq.com";
            this.mMttRequest.setUrl(this.e);
        }
        HttpTimeRecord.record(this.G, "wup_request_do_gzip_start", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        f();
        HttpTimeRecord.record(this.G, "wup_request_do_gzip_end", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        e();
        if (this.I && this.J) {
            this.mMttRequest.addHeader("host", WupProxyDomainRouter.f9957c.f9963b);
        }
        this.mMttRequest.setPostData(this.f10415c);
        this.mStatus = (byte) 5;
        if (!this.J || this.mMttRequest.getServerName() == null || this.mMttRequest.getFuncName() == null) {
            a2 = WupServerConfigsWrapper.a(this.B);
        } else {
            a2 = WupServerConfigsWrapper.b();
            Logs.d("wupRequest", "PBProxy getPBProxyAddress : " + a2);
        }
        if (this.J) {
            if (!a2.isEmpty()) {
                this.e = a2;
            }
        } else if (TextUtils.isEmpty(this.e)) {
            this.e = a2;
            Object obj = this.f;
            if (obj instanceof WUPRequestBase) {
                ((WUPRequestBase) obj).mStatAddressReason = WupServerConfigsWrapper.h();
                ((WUPRequestBase) this.f).mStatWupListIndex = WupServerConfigsWrapper.b(this.B);
                if (((WUPRequestBase) this.f).mIsMockForce) {
                    this.mStatus = (byte) 3;
                }
            }
            FLogger.d("wup-ip-list", "get from wup list = " + this.e);
        } else if (this.e.equalsIgnoreCase(a2)) {
            Object obj2 = this.f;
            if (obj2 instanceof WUPRequestBase) {
                ((WUPRequestBase) obj2).mStatAddressReason = WupServerConfigsWrapper.h();
                ((WUPRequestBase) this.f).mStatWupListIndex = WupServerConfigsWrapper.b(this.B);
            }
        }
        d();
        this.o = this.e;
        HttpTimeRecord.record(this.G, "wup_request_do_dns_start", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_do_dns_start").build()).group(this.G).setRawUrl(this.o).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_90425031) && this.F) {
            this.n = null;
        } else {
            this.n = l();
        }
        DnsManager.DnsData dnsData = this.n;
        if (dnsData != null && !TextUtils.isEmpty(dnsData.f9936b) && this.n.h >= 80) {
            StringBuilder sb = new StringBuilder();
            sb.append(this.I ? NetUtils.SCHEME_HTTPS : NetUtils.SCHEME_HTTP);
            sb.append(this.n.f9936b);
            sb.append(Constants.COLON_SEPARATOR);
            sb.append(this.n.h);
            this.e = sb.toString();
            FLogger.d("wup-ip-list", "need resolve domain, get ip from dns = " + this.e);
        }
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_do_dns_end").build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        HttpTimeRecord.record(this.G, "wup_request_do_dns_end", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        String str = this.e;
        Apn.ApnInfo apnInfo = Apn.getApnInfo(true);
        if (apnInfo == null || apnInfo.getApnType() != 4) {
            NetEventMonitor.getInstance().group(this.G).setNetState(0);
        } else {
            NetEventMonitor.getInstance().group(this.G).setNetState(1);
        }
        a(apnInfo);
        if (apnInfo == null || apnInfo.getApnType() != 2) {
            this.mMttRequest.setUseWapProxy(false);
        } else {
            str = str + "/cmwap";
            this.mMttRequest.setUseWapProxy(true);
        }
        if (this.p != null && !TextUtils.isEmpty(this.q)) {
            if (!this.mMttRequest.getUseWapProxy() && !str.endsWith("/")) {
                str = str + "/";
            }
            str = str + "?" + this.q;
        }
        IQBSpanProxy iQBSpanProxy = this.C;
        if (iQBSpanProxy != null) {
            iQBSpanProxy.addEvent("CHECK_URL").setAttribute("url", str);
        }
        this.mMttRequest.setUrl(str);
        Logs.d("wupRequest", "uniqueId=" + getUniqueId() + " real_url=" + this.mMttRequest.getUrl());
    }

    private void c(MttResponse mttResponse) {
        MttWupToken mttWupToken;
        String qSZip = mttResponse.getQSZip();
        if (TextUtils.isEmpty(qSZip)) {
            FLogger.d("WUPTask", "getQSZip == null");
        } else if ("gzip".equalsIgnoreCase(qSZip.trim().toLowerCase())) {
            this.h = true;
        }
        String qEncrypt = mttResponse.getQEncrypt();
        if (TextUtils.isEmpty(qEncrypt)) {
            FLogger.d("WUPTask", "getQEncrypt == null");
        } else {
            String lowerCase = qEncrypt.trim().toLowerCase();
            if ("12".equalsIgnoreCase(lowerCase) || com.tencent.connect.common.Constants.VIA_REPORT_TYPE_START_GROUP.equalsIgnoreCase(lowerCase)) {
                this.g = true;
            }
        }
        d(mttResponse);
        String tokenExpireSpan = mttResponse.getTokenExpireSpan();
        String qToken = mttResponse.getQToken();
        if (!TextUtils.isEmpty(tokenExpireSpan) && !TextUtils.isEmpty(qToken) && (mttWupToken = this.p) != null && mttWupToken.a(qToken, tokenExpireSpan)) {
            MttTokenProvider.a().c();
        }
        e(mttResponse);
        m();
    }

    private void d() {
        if (this.e == null) {
            this.e = (this.I ? WupProxyDomainRouter.f9957c : WupProxyDomainRouter.f9955a).f9962a;
        }
    }

    private void d(MttResponse mttResponse) {
        String wupEnvironment = mttResponse.getWupEnvironment();
        if (TextUtils.isEmpty(wupEnvironment) || !APMidasPayAPI.ENV_TEST.equalsIgnoreCase(wupEnvironment.trim().toLowerCase())) {
            return;
        }
        this.v = true;
    }

    private void e() {
        this.r = !this.I && this.r;
        if (this.r) {
            HttpTimeRecord.record(this.G, "wup_request_do_encrypt_start", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
            b(this.f10415c);
            HttpTimeRecord.record(this.G, "wup_request_do_encrypt_end", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        }
    }

    private void e(MttResponse mttResponse) {
        String headerField = mttResponse.getHeaderField("PB");
        if (!TextUtils.isEmpty(headerField)) {
            try {
                this.mRespDataType = Integer.parseInt(headerField);
            } catch (NumberFormatException unused) {
            }
            if (this.J) {
                return;
            }
            this.mRespDataType = 1;
            return;
        }
        this.mRespDataType = 2;
        if (this.J) {
        }
    }

    private void f() {
        if (this.I) {
            this.mMttRequest.removeHeader("Accept-Encoding");
        } else {
            this.mMttRequest.addHeader("Accept-Encoding", "identity");
            a(this.f10415c);
        }
    }

    private void g() {
        final long currentTimeMillis = System.currentTimeMillis();
        this.mErrorCode = 0;
        int i = this.f10413a;
        ArrayList<String> arrayList = this.mStatPath;
        StringBuilder sb = new StringBuilder();
        sb.append("wtrc_");
        sb.append(i - 1);
        arrayList.remove(sb.toString());
        this.mStatPath.add("wtrc_" + i);
        this.mRequester = RequesterFactory.getRequester(2);
        this.mRequester.setIntercepter(this);
        this.mRequester.setIsRemoveHeader(this.j);
        int c2 = this.y ? this.D.c() : this.D.d();
        this.mRequester.setConnectTimeout(this.y ? this.D.f() : this.D.g());
        this.mRequester.setReadTimeout(c2);
        this.mRequester.setCookieEnable(false);
        if (this.i) {
            this.mRequester.setQDebugEnable(false);
        }
        (UrlUtils.isIpv6Url(this.e) ? NetEventMonitor.getInstance().group(this.G).setIPType(1) : NetEventMonitor.getInstance().group(this.G).setIPType(0)).setRealUrl(this.e);
        try {
            this.mStatPath.add("wtsn");
            HttpTimeRecord.record(this.G, "wup_request_do_request_start", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
            NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_do_request_start").build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
            ValueCallback<MttResponse> valueCallback = new ValueCallback<MttResponse>() {
                @Override
                public void onReceiveValue(MttResponse mttResponse) {
                    WUPTask.this.a(mttResponse, currentTimeMillis);
                }
            };
            a(this.mMttRequest);
            this.mRequester.executeAsync(this.mMttRequest, valueCallback);
        } catch (Throwable th) {
            b(th);
        }
    }

    private void h() {
        if (this.mErrorCode != 0) {
            if (this.mErrorCode != 0) {
                j();
            }
            String c2 = c(this.mFailedReason);
            NetEventMonitor.getInstance().group(this.G).setErrorMsg(c2);
            a("wup_request_exception", this.mErrorCode, c2);
        }
        NetEventMonitor.getInstance().group(this.G).setThreadPerformEndTime(SystemClock.currentThreadTimeMillis());
    }

    private boolean i() {
        boolean z;
        String str;
        String str2;
        String str3;
        UnknownHostException unknownHostException;
        String str4;
        String str5;
        String str6;
        ConnectException connectException;
        String str7;
        String str8;
        String str9;
        OutOfMemoryError outOfMemoryError;
        String str10;
        String str11;
        String str12;
        Exception exc;
        String str13;
        String str14;
        String str15;
        IOException iOException;
        String str16;
        String str17;
        String str18;
        SocketTimeoutException socketTimeoutException;
        String str19;
        String str20;
        String str21;
        SocketException socketException;
        String str22;
        String str23;
        String str24;
        ProtocolException protocolException;
        String str25;
        String str26;
        String str27;
        Throwable th;
        int i;
        String tag;
        MttResponse execute;
        int i2;
        String tag2;
        String str28;
        int intValue;
        String str29;
        String str30;
        String str31;
        String str32;
        String str33;
        String str34;
        String str35;
        String str36;
        String tag3;
        String str37;
        String str38 = "wupError";
        long currentTimeMillis = System.currentTimeMillis();
        this.mErrorCode = 0;
        int i3 = this.f10413a;
        ArrayList<String> arrayList = this.mStatPath;
        StringBuilder sb = new StringBuilder();
        sb.append("wtrc_");
        sb.append(i3 - 1);
        arrayList.remove(sb.toString());
        this.mStatPath.add("wtrc_" + i3);
        this.mRequester = RequesterFactory.getRequester(2);
        this.mRequester.setIntercepter(this);
        this.mRequester.setIsRemoveHeader(this.j);
        int c2 = this.y ? this.D.c() : this.D.d();
        this.mRequester.setConnectTimeout(this.y ? this.D.f() : this.D.g());
        this.mRequester.setReadTimeout(c2);
        this.mRequester.setCookieEnable(false);
        if (this.i) {
            this.mRequester.setQDebugEnable(false);
        }
        boolean isIpv6Url = UrlUtils.isIpv6Url(this.e);
        INetEventGroup group = NetEventMonitor.getInstance().group(this.G);
        (isIpv6Url ? group.setIPType(1) : group.setIPType(0)).setRealUrl(this.e);
        boolean z2 = !isIpv6Url;
        try {
            try {
                try {
                    try {
                        this.mStatPath.add("wtsn");
                        i = this.G;
                        z = z2;
                        if (this.mMttRequest != null) {
                            try {
                                tag = this.mMttRequest.getTag();
                            } catch (OutOfMemoryError e) {
                                e = e;
                                outOfMemoryError = e;
                                str7 = " retryTimes=";
                                str8 = "wtme";
                                str9 = " exception=";
                                StringBuilder sb2 = new StringBuilder();
                                sb2.append("serverName=");
                                sb2.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb2.append("funcName=");
                                sb2.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb2.append(" mUrl=");
                                sb2.append(this.e);
                                sb2.append(" uniqueId=");
                                sb2.append(this.G);
                                sb2.append(" traceId=");
                                sb2.append(this.H);
                                sb2.append(str7);
                                sb2.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb2.append(str9);
                                sb2.append(outOfMemoryError);
                                Logs.d(str38, sb2.toString());
                                this.mFailedReason = outOfMemoryError;
                                this.mStatPath.add(str8);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_OOM;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_OOM");
                                    this.C.recordException(outOfMemoryError);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (ConnectException e2) {
                                e = e2;
                                connectException = e;
                                str4 = " retryTimes=";
                                str5 = "wtme";
                                str6 = " exception=";
                                StringBuilder sb3 = new StringBuilder();
                                sb3.append("serverName=");
                                sb3.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb3.append("funcName=");
                                sb3.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb3.append(" mUrl=");
                                sb3.append(this.e);
                                sb3.append(" uniqueId=");
                                sb3.append(this.G);
                                sb3.append(" traceId=");
                                sb3.append(this.H);
                                sb3.append(str4);
                                sb3.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb3.append(str6);
                                sb3.append(connectException);
                                Logs.d(str38, sb3.toString());
                                this.mFailedReason = connectException;
                                this.mStatPath.add(str5);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_CONN_EXCEPTION;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_UNKNOWN_HOST_EXCEPTION");
                                    this.C.recordException(connectException);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (ProtocolException e3) {
                                e = e3;
                                protocolException = e;
                                str22 = " retryTimes=";
                                str23 = "wtme";
                                str24 = " exception=";
                                StringBuilder sb4 = new StringBuilder();
                                sb4.append("serverName=");
                                sb4.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb4.append("funcName=");
                                sb4.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb4.append(" mUrl=");
                                sb4.append(this.e);
                                sb4.append(" uniqueId=");
                                sb4.append(this.G);
                                sb4.append(" traceId=");
                                sb4.append(this.H);
                                sb4.append(str22);
                                sb4.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb4.append(str24);
                                sb4.append(protocolException);
                                Logs.d(str38, sb4.toString());
                                this.mFailedReason = protocolException;
                                this.mStatPath.add(str23);
                                this.mErrorCode = WUPConst.WUP_E_CODE_PROTOCAL_ERROR;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_PROTOCAL_ERROR");
                                    this.C.recordException(protocolException);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (SocketException e4) {
                                e = e4;
                                socketException = e;
                                str19 = " retryTimes=";
                                str20 = "wtme";
                                str21 = " exception=";
                                StringBuilder sb5 = new StringBuilder();
                                sb5.append("serverName=");
                                sb5.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb5.append("funcName=");
                                sb5.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb5.append(" mUrl=");
                                sb5.append(this.e);
                                sb5.append(" uniqueId=");
                                sb5.append(this.G);
                                sb5.append(" traceId=");
                                sb5.append(this.H);
                                sb5.append(str19);
                                sb5.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb5.append(str21);
                                sb5.append(socketException);
                                Logs.d(str38, sb5.toString());
                                this.mFailedReason = socketException;
                                this.mStatPath.add(str20);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_SOCKET_EXCEPTION;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_SOCKET_EXCEPTION");
                                    this.C.recordException(socketException);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (SocketTimeoutException e5) {
                                e = e5;
                                socketTimeoutException = e;
                                str16 = " retryTimes=";
                                str17 = "wtme";
                                str18 = " exception=";
                                StringBuilder sb6 = new StringBuilder();
                                sb6.append("serverName=");
                                sb6.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb6.append("funcName=");
                                sb6.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb6.append(" mUrl=");
                                sb6.append(this.e);
                                sb6.append(" uniqueId=");
                                sb6.append(this.G);
                                sb6.append(" traceId=");
                                sb6.append(this.H);
                                sb6.append(str16);
                                sb6.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb6.append(str18);
                                sb6.append(socketTimeoutException);
                                Logs.d(str38, sb6.toString());
                                this.mFailedReason = socketTimeoutException;
                                this.mStatPath.add(str17);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_SOCKET_TIME_OUT_EXCEPTION;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_SOCKET_TIME_OUT_EXCEPTION");
                                    this.C.recordException(socketTimeoutException);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (UnknownHostException e6) {
                                e = e6;
                                unknownHostException = e;
                                str = " retryTimes=";
                                str2 = "wtme";
                                str3 = " exception=";
                                StringBuilder sb7 = new StringBuilder();
                                sb7.append("serverName=");
                                sb7.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb7.append("funcName=");
                                sb7.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb7.append(" mUrl=");
                                sb7.append(this.e);
                                sb7.append(" uniqueId=");
                                sb7.append(this.G);
                                sb7.append(" traceId=");
                                sb7.append(this.H);
                                sb7.append(str);
                                sb7.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb7.append(str3);
                                sb7.append(unknownHostException);
                                Logs.d(str38, sb7.toString());
                                this.mFailedReason = unknownHostException;
                                this.mStatPath.add(str2);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_UNKNOWN_HOST_EXCEPTION;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_UNKNOWN_HOST_EXCEPTION");
                                    this.C.recordException(unknownHostException);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (IOException e7) {
                                e = e7;
                                iOException = e;
                                str13 = " retryTimes=";
                                str14 = "wtme";
                                str15 = " exception=";
                                StringBuilder sb8 = new StringBuilder();
                                sb8.append("serverName=");
                                sb8.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb8.append("funcName=");
                                sb8.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb8.append(" mUrl=");
                                sb8.append(this.e);
                                sb8.append(" uniqueId=");
                                sb8.append(this.G);
                                sb8.append(" traceId=");
                                sb8.append(this.H);
                                sb8.append(str13);
                                sb8.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb8.append(str15);
                                sb8.append(iOException);
                                Logs.d(str38, sb8.toString());
                                this.mFailedReason = iOException;
                                this.mStatPath.add(str14);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_IO_EXCEPTION;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_IO_EXCEPTION");
                                    this.C.recordException(iOException);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (Exception e8) {
                                e = e8;
                                exc = e;
                                str10 = " retryTimes=";
                                str11 = "wtme";
                                str12 = " exception=";
                                StringBuilder sb9 = new StringBuilder();
                                sb9.append("serverName=");
                                sb9.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb9.append("funcName=");
                                sb9.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb9.append(" mUrl=");
                                sb9.append(this.e);
                                sb9.append(" uniqueId=");
                                sb9.append(this.G);
                                sb9.append(" traceId=");
                                sb9.append(this.H);
                                sb9.append(str10);
                                sb9.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb9.append(str12);
                                sb9.append(exc);
                                Logs.d(str38, sb9.toString());
                                this.mFailedReason = exc;
                                this.mStatPath.add(str11);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                                if (this.C != null) {
                                    this.C.addEvent("WUP_E_CODE_NET_EXCEPTION");
                                    this.C.recordException(exc);
                                }
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (Throwable th2) {
                                th = th2;
                                str25 = " exception=";
                                str26 = " retryTimes=";
                                str27 = "wupError";
                                StringBuilder sb10 = new StringBuilder();
                                sb10.append("serverName=");
                                sb10.append(this.mMttRequest.getServerName() == null ? this.mMttRequest.getServerName() : "");
                                sb10.append("funcName=");
                                sb10.append(this.mMttRequest.getFuncName() == null ? this.mMttRequest.getFuncName() : "");
                                sb10.append(" mUrl=");
                                sb10.append(this.e);
                                sb10.append(" uniqueId=");
                                sb10.append(this.G);
                                sb10.append(" traceId=");
                                sb10.append(this.H);
                                sb10.append(str26);
                                sb10.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb10.append(str25);
                                sb10.append(th);
                                Logs.d(str27, sb10.toString());
                                FLogger.e("WUPTask", th);
                                this.mFailedReason = th;
                                this.mStatPath.add("wtme");
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            }
                        } else {
                            tag = null;
                        }
                        str27 = "wupError";
                    } catch (OutOfMemoryError e9) {
                        e = e9;
                        z = z2;
                    } catch (ConnectException e10) {
                        e = e10;
                        z = z2;
                    } catch (ProtocolException e11) {
                        e = e11;
                        z = z2;
                    } catch (SocketException e12) {
                        e = e12;
                        z = z2;
                    } catch (SocketTimeoutException e13) {
                        e = e13;
                        z = z2;
                    } catch (UnknownHostException e14) {
                        e = e14;
                        z = z2;
                    } catch (IOException e15) {
                        e = e15;
                        z = z2;
                    } catch (Exception e16) {
                        e = e16;
                        z = z2;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    z = z2;
                    str25 = " exception=";
                    str26 = " retryTimes=";
                    str27 = "wupError";
                }
            } catch (ProtocolException e17) {
                z = z2;
                str22 = " retryTimes=";
                str23 = "wtme";
                str24 = " exception=";
                protocolException = e17;
            } catch (SocketException e18) {
                z = z2;
                str19 = " retryTimes=";
                str20 = "wtme";
                str21 = " exception=";
                socketException = e18;
            } catch (SocketTimeoutException e19) {
                z = z2;
                str16 = " retryTimes=";
                str17 = "wtme";
                str18 = " exception=";
                socketTimeoutException = e19;
            } catch (IOException e20) {
                z = z2;
                str13 = " retryTimes=";
                str14 = "wtme";
                str15 = " exception=";
                iOException = e20;
            } catch (Exception e21) {
                z = z2;
                str10 = " retryTimes=";
                str11 = "wtme";
                str12 = " exception=";
                exc = e21;
            } catch (OutOfMemoryError e22) {
                z = z2;
                str7 = " retryTimes=";
                str8 = "wtme";
                str9 = " exception=";
                outOfMemoryError = e22;
            } catch (ConnectException e23) {
                z = z2;
                str4 = " retryTimes=";
                str5 = "wtme";
                str6 = " exception=";
                connectException = e23;
            } catch (UnknownHostException e24) {
                z = z2;
                str = " retryTimes=";
                str2 = "wtme";
                str3 = " exception=";
                unknownHostException = e24;
            }
            try {
                try {
                    HttpTimeRecord.record(i, "wup_request_do_request_start", -1, tag, null);
                    NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_do_request_start").build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
                    a(this.mMttRequest);
                    execute = this.mRequester.execute(this.mMttRequest);
                    NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_do_request_end").build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
                    i2 = this.G;
                    if (this.mMttRequest != null) {
                        try {
                            tag2 = this.mMttRequest.getTag();
                            str25 = " exception=";
                            str28 = null;
                        } catch (Throwable th4) {
                            th = th4;
                            str25 = " exception=";
                            str26 = " retryTimes=";
                            StringBuilder sb102 = new StringBuilder();
                            sb102.append("serverName=");
                            sb102.append(this.mMttRequest.getServerName() == null ? this.mMttRequest.getServerName() : "");
                            sb102.append("funcName=");
                            sb102.append(this.mMttRequest.getFuncName() == null ? this.mMttRequest.getFuncName() : "");
                            sb102.append(" mUrl=");
                            sb102.append(this.e);
                            sb102.append(" uniqueId=");
                            sb102.append(this.G);
                            sb102.append(" traceId=");
                            sb102.append(this.H);
                            sb102.append(str26);
                            sb102.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                            sb102.append(str25);
                            sb102.append(th);
                            Logs.d(str27, sb102.toString());
                            FLogger.e("WUPTask", th);
                            this.mFailedReason = th;
                            this.mStatPath.add("wtme");
                            this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                            if (this.C != null) {
                            }
                            if (this.mRequester != null) {
                            }
                            this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                        }
                    } else {
                        str25 = " exception=";
                        str28 = null;
                        tag2 = null;
                    }
                } catch (Throwable th5) {
                    th = th5;
                    str25 = " exception=";
                }
                try {
                    try {
                        HttpTimeRecord.record(i2, "wup_request_do_request_end", -1, tag2, str28);
                        this.mStatPath.add("wten");
                        this.mNetworkStatus = this.mMttRequest.mNetworkStatus;
                        setMttResponse(execute);
                        k();
                        intValue = execute.getStatusCode().intValue();
                        this.mStatPath.add("wtsc_" + intValue);
                    } catch (Throwable th6) {
                        th = th6;
                        str26 = " retryTimes=";
                        th = th;
                        StringBuilder sb1022 = new StringBuilder();
                        sb1022.append("serverName=");
                        sb1022.append(this.mMttRequest.getServerName() == null ? this.mMttRequest.getServerName() : "");
                        sb1022.append("funcName=");
                        sb1022.append(this.mMttRequest.getFuncName() == null ? this.mMttRequest.getFuncName() : "");
                        sb1022.append(" mUrl=");
                        sb1022.append(this.e);
                        sb1022.append(" uniqueId=");
                        sb1022.append(this.G);
                        sb1022.append(" traceId=");
                        sb1022.append(this.H);
                        sb1022.append(str26);
                        sb1022.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                        sb1022.append(str25);
                        sb1022.append(th);
                        Logs.d(str27, sb1022.toString());
                        FLogger.e("WUPTask", th);
                        this.mFailedReason = th;
                        this.mStatPath.add("wtme");
                        this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                        if (this.C != null) {
                        }
                        if (this.mRequester != null) {
                        }
                        this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                    }
                    try {
                        if (intValue == 200) {
                            int i4 = this.G;
                            if (this.mMttRequest != null) {
                                try {
                                    tag3 = this.mMttRequest.getTag();
                                    str37 = null;
                                } catch (Throwable th7) {
                                    th = th7;
                                    str26 = " retryTimes=";
                                    StringBuilder sb10222 = new StringBuilder();
                                    sb10222.append("serverName=");
                                    sb10222.append(this.mMttRequest.getServerName() == null ? this.mMttRequest.getServerName() : "");
                                    sb10222.append("funcName=");
                                    sb10222.append(this.mMttRequest.getFuncName() == null ? this.mMttRequest.getFuncName() : "");
                                    sb10222.append(" mUrl=");
                                    sb10222.append(this.e);
                                    sb10222.append(" uniqueId=");
                                    sb10222.append(this.G);
                                    sb10222.append(" traceId=");
                                    sb10222.append(this.H);
                                    sb10222.append(str26);
                                    sb10222.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                    sb10222.append(str25);
                                    sb10222.append(th);
                                    Logs.d(str27, sb10222.toString());
                                    FLogger.e("WUPTask", th);
                                    this.mFailedReason = th;
                                    this.mStatPath.add("wtme");
                                    this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                                    if (this.C != null) {
                                        this.C.addEvent("WUP_E_CODE_NET_EXCEPTION_2");
                                        this.C.recordException(th);
                                    }
                                    if (this.mRequester != null) {
                                        this.mRequester.close();
                                    }
                                    this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                                }
                            } else {
                                str37 = null;
                                tag3 = null;
                            }
                            HttpTimeRecord.record(i4, "wup_request_http_success_start", -1, tag3, str37);
                            NetEvent build = NetEvent.newBuilder().event("wup_request_http_success_start").build();
                            if (this.C != null) {
                                this.C.addEvent("WUP_REQUEST_HTTP_SUCCESS_START");
                            }
                            NetEventMonitor.getInstance().stat(this.G, build).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
                            c(execute);
                            MttInputStream inputStream = execute.getInputStream();
                            if (inputStream != null) {
                                this.f10414b = a(inputStream, execute);
                                if (this.f10414b != null) {
                                    execute.setFlow(this.f10414b.length);
                                }
                            } else {
                                this.mStatPath.add("wtei");
                            }
                            this.mStatPath.add("wtno");
                            this.mStatus = (byte) 3;
                            NetEvent build2 = NetEvent.newBuilder().event("wup_request_http_success_end").build();
                            a(execute);
                            if (this.C != null) {
                                this.C.addEvent("WUP_REQUEST_HTTP_SUCCESS_END");
                            }
                            NetEventMonitor.getInstance().stat(this.G, build2).group(this.G).setThreadPerformEndTime(SystemClock.currentThreadTimeMillis()).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
                            HttpTimeRecord.record(this.G, "wup_request_http_success_end", -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
                            a(intValue, false);
                            if (this.mRequester != null) {
                                this.mRequester.close();
                            }
                            this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            if (this.y) {
                                return true;
                            }
                            this.D.a(System.currentTimeMillis() - currentTimeMillis);
                            return true;
                        }
                        str26 = " retryTimes=";
                        if (intValue < 700 || intValue > 702) {
                            a(intValue, true);
                            this.mErrorCode = -2001;
                            if (this.mRequester != null) {
                                this.mRequester.close();
                            }
                            this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                        } else {
                            HttpTimeRecord.record(this.G, HttpTimeRecord.WUP_REQUEST_HTTP_FAILED_START, -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
                            NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event(INetEvent.WUP_REQUEST_HTTP_ERROR_START).code(WUPConst.WUP_E_CODE_SERVER_DECRYPT_ERROR).build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
                            try {
                                this.mErrorCode = WUPConst.WUP_E_CODE_SERVER_DECRYPT_ERROR;
                                String str39 = "server_dec_error_" + intValue;
                                StringBuilder sb11 = new StringBuilder();
                                sb11.append("Current Padding is ");
                                sb11.append((int) this.t);
                                sb11.append(", is using token? ");
                                sb11.append((this.p == null || TextUtils.isEmpty(this.p.f10478a)) ? false : true);
                                a(str39, new Throwable(sb11.toString()));
                                if (this.t == 2 && intValue == 702) {
                                    this.A.c().b();
                                }
                                if (this.p != null) {
                                    this.p.a(true);
                                }
                                NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event(INetEvent.WUP_REQUEST_HTTP_ERROR_END).code(WUPConst.WUP_E_CODE_SERVER_DECRYPT_ERROR).build()).group(this.G).setFuncName(this.mMttRequest.getFuncName()).setThreadPerformEndTime(SystemClock.currentThreadTimeMillis()).setServerName(this.mMttRequest.getServerName());
                                HttpTimeRecord.record(this.G, HttpTimeRecord.WUP_REQUEST_HTTP_FAILED_END, -1, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
                                a(intValue, true);
                                if (this.mRequester != null) {
                                    this.mRequester.close();
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                                if (this.y) {
                                    return true;
                                }
                                this.D.a(System.currentTimeMillis() - currentTimeMillis);
                                return true;
                            } catch (ConnectException e25) {
                                connectException = e25;
                                str5 = "wtme";
                                str38 = str27;
                                str6 = str25;
                                str4 = str26;
                                z = false;
                                StringBuilder sb32 = new StringBuilder();
                                sb32.append("serverName=");
                                sb32.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb32.append("funcName=");
                                sb32.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb32.append(" mUrl=");
                                sb32.append(this.e);
                                sb32.append(" uniqueId=");
                                sb32.append(this.G);
                                sb32.append(" traceId=");
                                sb32.append(this.H);
                                sb32.append(str4);
                                sb32.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb32.append(str6);
                                sb32.append(connectException);
                                Logs.d(str38, sb32.toString());
                                this.mFailedReason = connectException;
                                this.mStatPath.add(str5);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_CONN_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (ProtocolException e26) {
                                protocolException = e26;
                                str23 = "wtme";
                                str38 = str27;
                                str24 = str25;
                                str22 = str26;
                                z = false;
                                StringBuilder sb42 = new StringBuilder();
                                sb42.append("serverName=");
                                sb42.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb42.append("funcName=");
                                sb42.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb42.append(" mUrl=");
                                sb42.append(this.e);
                                sb42.append(" uniqueId=");
                                sb42.append(this.G);
                                sb42.append(" traceId=");
                                sb42.append(this.H);
                                sb42.append(str22);
                                sb42.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb42.append(str24);
                                sb42.append(protocolException);
                                Logs.d(str38, sb42.toString());
                                this.mFailedReason = protocolException;
                                this.mStatPath.add(str23);
                                this.mErrorCode = WUPConst.WUP_E_CODE_PROTOCAL_ERROR;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (SocketException e27) {
                                socketException = e27;
                                str20 = "wtme";
                                str38 = str27;
                                str21 = str25;
                                str19 = str26;
                                z = false;
                                StringBuilder sb52 = new StringBuilder();
                                sb52.append("serverName=");
                                sb52.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb52.append("funcName=");
                                sb52.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb52.append(" mUrl=");
                                sb52.append(this.e);
                                sb52.append(" uniqueId=");
                                sb52.append(this.G);
                                sb52.append(" traceId=");
                                sb52.append(this.H);
                                sb52.append(str19);
                                sb52.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb52.append(str21);
                                sb52.append(socketException);
                                Logs.d(str38, sb52.toString());
                                this.mFailedReason = socketException;
                                this.mStatPath.add(str20);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_SOCKET_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (SocketTimeoutException e28) {
                                socketTimeoutException = e28;
                                str17 = "wtme";
                                str38 = str27;
                                str18 = str25;
                                str16 = str26;
                                z = false;
                                StringBuilder sb62 = new StringBuilder();
                                sb62.append("serverName=");
                                sb62.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb62.append("funcName=");
                                sb62.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb62.append(" mUrl=");
                                sb62.append(this.e);
                                sb62.append(" uniqueId=");
                                sb62.append(this.G);
                                sb62.append(" traceId=");
                                sb62.append(this.H);
                                sb62.append(str16);
                                sb62.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb62.append(str18);
                                sb62.append(socketTimeoutException);
                                Logs.d(str38, sb62.toString());
                                this.mFailedReason = socketTimeoutException;
                                this.mStatPath.add(str17);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_SOCKET_TIME_OUT_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (UnknownHostException e29) {
                                unknownHostException = e29;
                                str2 = "wtme";
                                str38 = str27;
                                str3 = str25;
                                str = str26;
                                z = false;
                                StringBuilder sb72 = new StringBuilder();
                                sb72.append("serverName=");
                                sb72.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb72.append("funcName=");
                                sb72.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb72.append(" mUrl=");
                                sb72.append(this.e);
                                sb72.append(" uniqueId=");
                                sb72.append(this.G);
                                sb72.append(" traceId=");
                                sb72.append(this.H);
                                sb72.append(str);
                                sb72.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb72.append(str3);
                                sb72.append(unknownHostException);
                                Logs.d(str38, sb72.toString());
                                this.mFailedReason = unknownHostException;
                                this.mStatPath.add(str2);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_UNKNOWN_HOST_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (IOException e30) {
                                iOException = e30;
                                str14 = "wtme";
                                str38 = str27;
                                str15 = str25;
                                str13 = str26;
                                z = false;
                                StringBuilder sb82 = new StringBuilder();
                                sb82.append("serverName=");
                                sb82.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb82.append("funcName=");
                                sb82.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb82.append(" mUrl=");
                                sb82.append(this.e);
                                sb82.append(" uniqueId=");
                                sb82.append(this.G);
                                sb82.append(" traceId=");
                                sb82.append(this.H);
                                sb82.append(str13);
                                sb82.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb82.append(str15);
                                sb82.append(iOException);
                                Logs.d(str38, sb82.toString());
                                this.mFailedReason = iOException;
                                this.mStatPath.add(str14);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_IO_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (Exception e31) {
                                exc = e31;
                                str11 = "wtme";
                                str38 = str27;
                                str12 = str25;
                                str10 = str26;
                                z = false;
                                StringBuilder sb92 = new StringBuilder();
                                sb92.append("serverName=");
                                sb92.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb92.append("funcName=");
                                sb92.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb92.append(" mUrl=");
                                sb92.append(this.e);
                                sb92.append(" uniqueId=");
                                sb92.append(this.G);
                                sb92.append(" traceId=");
                                sb92.append(this.H);
                                sb92.append(str10);
                                sb92.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb92.append(str12);
                                sb92.append(exc);
                                Logs.d(str38, sb92.toString());
                                this.mFailedReason = exc;
                                this.mStatPath.add(str11);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (OutOfMemoryError e32) {
                                outOfMemoryError = e32;
                                str8 = "wtme";
                                str38 = str27;
                                str9 = str25;
                                str7 = str26;
                                z = false;
                                StringBuilder sb22 = new StringBuilder();
                                sb22.append("serverName=");
                                sb22.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                                sb22.append("funcName=");
                                sb22.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                                sb22.append(" mUrl=");
                                sb22.append(this.e);
                                sb22.append(" uniqueId=");
                                sb22.append(this.G);
                                sb22.append(" traceId=");
                                sb22.append(this.H);
                                sb22.append(str7);
                                sb22.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb22.append(str9);
                                sb22.append(outOfMemoryError);
                                Logs.d(str38, sb22.toString());
                                this.mFailedReason = outOfMemoryError;
                                this.mStatPath.add(str8);
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_OOM;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            } catch (Throwable th8) {
                                th = th8;
                                z = false;
                                StringBuilder sb102222 = new StringBuilder();
                                sb102222.append("serverName=");
                                sb102222.append(this.mMttRequest.getServerName() == null ? this.mMttRequest.getServerName() : "");
                                sb102222.append("funcName=");
                                sb102222.append(this.mMttRequest.getFuncName() == null ? this.mMttRequest.getFuncName() : "");
                                sb102222.append(" mUrl=");
                                sb102222.append(this.e);
                                sb102222.append(" uniqueId=");
                                sb102222.append(this.G);
                                sb102222.append(" traceId=");
                                sb102222.append(this.H);
                                sb102222.append(str26);
                                sb102222.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                                sb102222.append(str25);
                                sb102222.append(th);
                                Logs.d(str27, sb102222.toString());
                                FLogger.e("WUPTask", th);
                                this.mFailedReason = th;
                                this.mStatPath.add("wtme");
                                this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                                if (this.C != null) {
                                }
                                if (this.mRequester != null) {
                                }
                                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                            }
                        }
                    } catch (OutOfMemoryError e33) {
                        outOfMemoryError = e33;
                        str8 = "wtme";
                        str38 = str27;
                        str9 = str25;
                        str7 = str36;
                    } catch (ConnectException e34) {
                        connectException = e34;
                        str5 = "wtme";
                        str38 = str27;
                        str6 = str25;
                        str4 = str35;
                    } catch (ProtocolException e35) {
                        protocolException = e35;
                        str23 = "wtme";
                        str38 = str27;
                        str24 = str25;
                        str22 = str34;
                    } catch (SocketException e36) {
                        socketException = e36;
                        str20 = "wtme";
                        str38 = str27;
                        str21 = str25;
                        str19 = str33;
                    } catch (SocketTimeoutException e37) {
                        socketTimeoutException = e37;
                        str17 = "wtme";
                        str38 = str27;
                        str18 = str25;
                        str16 = str32;
                    } catch (UnknownHostException e38) {
                        unknownHostException = e38;
                        str2 = "wtme";
                        str38 = str27;
                        str3 = str25;
                        str = str31;
                    } catch (IOException e39) {
                        iOException = e39;
                        str14 = "wtme";
                        str38 = str27;
                        str15 = str25;
                        str13 = str30;
                    } catch (Exception e40) {
                        exc = e40;
                        str11 = "wtme";
                        str38 = str27;
                        str12 = str25;
                        str10 = str29;
                    } catch (Throwable th9) {
                        th = th9;
                        th = th;
                        StringBuilder sb1022222 = new StringBuilder();
                        sb1022222.append("serverName=");
                        sb1022222.append(this.mMttRequest.getServerName() == null ? this.mMttRequest.getServerName() : "");
                        sb1022222.append("funcName=");
                        sb1022222.append(this.mMttRequest.getFuncName() == null ? this.mMttRequest.getFuncName() : "");
                        sb1022222.append(" mUrl=");
                        sb1022222.append(this.e);
                        sb1022222.append(" uniqueId=");
                        sb1022222.append(this.G);
                        sb1022222.append(" traceId=");
                        sb1022222.append(this.H);
                        sb1022222.append(str26);
                        sb1022222.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                        sb1022222.append(str25);
                        sb1022222.append(th);
                        Logs.d(str27, sb1022222.toString());
                        FLogger.e("WUPTask", th);
                        this.mFailedReason = th;
                        this.mStatPath.add("wtme");
                        this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                        if (this.C != null) {
                        }
                        if (this.mRequester != null) {
                        }
                        this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                    }
                } catch (OutOfMemoryError e41) {
                    outOfMemoryError = e41;
                    str7 = " retryTimes=";
                    str8 = "wtme";
                    str38 = str27;
                    str9 = str25;
                } catch (ConnectException e42) {
                    connectException = e42;
                    str4 = " retryTimes=";
                    str5 = "wtme";
                    str38 = str27;
                    str6 = str25;
                } catch (ProtocolException e43) {
                    protocolException = e43;
                    str22 = " retryTimes=";
                    str23 = "wtme";
                    str38 = str27;
                    str24 = str25;
                } catch (SocketException e44) {
                    socketException = e44;
                    str19 = " retryTimes=";
                    str20 = "wtme";
                    str38 = str27;
                    str21 = str25;
                } catch (SocketTimeoutException e45) {
                    socketTimeoutException = e45;
                    str16 = " retryTimes=";
                    str17 = "wtme";
                    str38 = str27;
                    str18 = str25;
                } catch (UnknownHostException e46) {
                    unknownHostException = e46;
                    str = " retryTimes=";
                    str2 = "wtme";
                    str38 = str27;
                    str3 = str25;
                } catch (IOException e47) {
                    iOException = e47;
                    str13 = " retryTimes=";
                    str14 = "wtme";
                    str38 = str27;
                    str15 = str25;
                } catch (Exception e48) {
                    exc = e48;
                    str10 = " retryTimes=";
                    str11 = "wtme";
                    str38 = str27;
                    str12 = str25;
                }
            } catch (IOException e49) {
                iOException = e49;
                str13 = " retryTimes=";
                str14 = "wtme";
                str38 = str27;
                str15 = " exception=";
                StringBuilder sb822 = new StringBuilder();
                sb822.append("serverName=");
                sb822.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb822.append("funcName=");
                sb822.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb822.append(" mUrl=");
                sb822.append(this.e);
                sb822.append(" uniqueId=");
                sb822.append(this.G);
                sb822.append(" traceId=");
                sb822.append(this.H);
                sb822.append(str13);
                sb822.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb822.append(str15);
                sb822.append(iOException);
                Logs.d(str38, sb822.toString());
                this.mFailedReason = iOException;
                this.mStatPath.add(str14);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_IO_EXCEPTION;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (Exception e50) {
                exc = e50;
                str10 = " retryTimes=";
                str11 = "wtme";
                str38 = str27;
                str12 = " exception=";
                StringBuilder sb922 = new StringBuilder();
                sb922.append("serverName=");
                sb922.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb922.append("funcName=");
                sb922.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb922.append(" mUrl=");
                sb922.append(this.e);
                sb922.append(" uniqueId=");
                sb922.append(this.G);
                sb922.append(" traceId=");
                sb922.append(this.H);
                sb922.append(str10);
                sb922.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb922.append(str12);
                sb922.append(exc);
                Logs.d(str38, sb922.toString());
                this.mFailedReason = exc;
                this.mStatPath.add(str11);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_EXCEPTION;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (OutOfMemoryError e51) {
                outOfMemoryError = e51;
                str7 = " retryTimes=";
                str8 = "wtme";
                str38 = str27;
                str9 = " exception=";
                StringBuilder sb222 = new StringBuilder();
                sb222.append("serverName=");
                sb222.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb222.append("funcName=");
                sb222.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb222.append(" mUrl=");
                sb222.append(this.e);
                sb222.append(" uniqueId=");
                sb222.append(this.G);
                sb222.append(" traceId=");
                sb222.append(this.H);
                sb222.append(str7);
                sb222.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb222.append(str9);
                sb222.append(outOfMemoryError);
                Logs.d(str38, sb222.toString());
                this.mFailedReason = outOfMemoryError;
                this.mStatPath.add(str8);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_OOM;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (ConnectException e52) {
                connectException = e52;
                str4 = " retryTimes=";
                str5 = "wtme";
                str38 = str27;
                str6 = " exception=";
                StringBuilder sb322 = new StringBuilder();
                sb322.append("serverName=");
                sb322.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb322.append("funcName=");
                sb322.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb322.append(" mUrl=");
                sb322.append(this.e);
                sb322.append(" uniqueId=");
                sb322.append(this.G);
                sb322.append(" traceId=");
                sb322.append(this.H);
                sb322.append(str4);
                sb322.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb322.append(str6);
                sb322.append(connectException);
                Logs.d(str38, sb322.toString());
                this.mFailedReason = connectException;
                this.mStatPath.add(str5);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_CONN_EXCEPTION;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (ProtocolException e53) {
                protocolException = e53;
                str22 = " retryTimes=";
                str23 = "wtme";
                str38 = str27;
                str24 = " exception=";
                StringBuilder sb422 = new StringBuilder();
                sb422.append("serverName=");
                sb422.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb422.append("funcName=");
                sb422.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb422.append(" mUrl=");
                sb422.append(this.e);
                sb422.append(" uniqueId=");
                sb422.append(this.G);
                sb422.append(" traceId=");
                sb422.append(this.H);
                sb422.append(str22);
                sb422.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb422.append(str24);
                sb422.append(protocolException);
                Logs.d(str38, sb422.toString());
                this.mFailedReason = protocolException;
                this.mStatPath.add(str23);
                this.mErrorCode = WUPConst.WUP_E_CODE_PROTOCAL_ERROR;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (SocketException e54) {
                socketException = e54;
                str19 = " retryTimes=";
                str20 = "wtme";
                str38 = str27;
                str21 = " exception=";
                StringBuilder sb522 = new StringBuilder();
                sb522.append("serverName=");
                sb522.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb522.append("funcName=");
                sb522.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb522.append(" mUrl=");
                sb522.append(this.e);
                sb522.append(" uniqueId=");
                sb522.append(this.G);
                sb522.append(" traceId=");
                sb522.append(this.H);
                sb522.append(str19);
                sb522.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb522.append(str21);
                sb522.append(socketException);
                Logs.d(str38, sb522.toString());
                this.mFailedReason = socketException;
                this.mStatPath.add(str20);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_SOCKET_EXCEPTION;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (SocketTimeoutException e55) {
                socketTimeoutException = e55;
                str16 = " retryTimes=";
                str17 = "wtme";
                str38 = str27;
                str18 = " exception=";
                StringBuilder sb622 = new StringBuilder();
                sb622.append("serverName=");
                sb622.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb622.append("funcName=");
                sb622.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb622.append(" mUrl=");
                sb622.append(this.e);
                sb622.append(" uniqueId=");
                sb622.append(this.G);
                sb622.append(" traceId=");
                sb622.append(this.H);
                sb622.append(str16);
                sb622.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb622.append(str18);
                sb622.append(socketTimeoutException);
                Logs.d(str38, sb622.toString());
                this.mFailedReason = socketTimeoutException;
                this.mStatPath.add(str17);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_SOCKET_TIME_OUT_EXCEPTION;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            } catch (UnknownHostException e56) {
                unknownHostException = e56;
                str = " retryTimes=";
                str2 = "wtme";
                str38 = str27;
                str3 = " exception=";
                StringBuilder sb722 = new StringBuilder();
                sb722.append("serverName=");
                sb722.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
                sb722.append("funcName=");
                sb722.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
                sb722.append(" mUrl=");
                sb722.append(this.e);
                sb722.append(" uniqueId=");
                sb722.append(this.G);
                sb722.append(" traceId=");
                sb722.append(this.H);
                sb722.append(str);
                sb722.append((getBindObject() == null && (getBindObject() instanceof WUPRequestBase)) ? Integer.valueOf(((WUPRequestBase) getBindObject()).getTriedTimes()) : IAPInjectService.EP_NULL);
                sb722.append(str3);
                sb722.append(unknownHostException);
                Logs.d(str38, sb722.toString());
                this.mFailedReason = unknownHostException;
                this.mStatPath.add(str2);
                this.mErrorCode = WUPConst.WUP_E_CODE_NET_UNKNOWN_HOST_EXCEPTION;
                if (this.C != null) {
                }
                if (this.mRequester != null) {
                }
                this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            }
        } catch (Throwable th10) {
            if (this.mRequester != null) {
                this.mRequester.close();
            }
            this.mNetTimeList.add(Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
            if (this.y) {
                throw th10;
            }
            this.D.a(System.currentTimeMillis() - currentTimeMillis);
            throw th10;
        }
    }

    private void j() {
        if ((TWSettingManager.a().a("ANDROID_PUBLIC_PREFS_IS_TENCENT_WIFI_USER", "0").equals("1") || TWSettingManager.a().a("ANDROID_PUBLIC_PREFS_INNER_EXPERIENCE_SWITCHER", "0").equals("1")) && !HttpTimeRecord.isDebugMode) {
            StringBuilder sb = new StringBuilder();
            sb.append("serverName=");
            sb.append(this.mMttRequest.getServerName() != null ? this.mMttRequest.getServerName() : "");
            sb.append("funcName=");
            sb.append(this.mMttRequest.getFuncName() != null ? this.mMttRequest.getFuncName() : "");
            sb.append(" mUrl=");
            sb.append(this.e);
            sb.append(" uniqueId=");
            sb.append(this.G);
            sb.append(" traceId=");
            sb.append(this.H);
            sb.append(" start record all info");
            Logs.d("wupRequest", sb.toString());
            HttpTimeRecord.isDebugMode = true;
        }
    }

    private void k() {
        if (getMttResponse() == null) {
            return;
        }
        WupServerConfigsWrapper.f9977d = (getMttResponse().getHeaderField("ENV") == null || !getMttResponse().getHeaderField("ENV").contains(APMidasPayAPI.ENV_TEST)) ? 1 : 2;
    }

    private DnsManager.DnsData l() {
        DnsManager.DnsData dnsData = null;
        if (!WupProxyDomainRouter.a(this.e)) {
            return null;
        }
        try {
            String sb = IPListUtils.c(ContextHolder.getAppContext()).toString();
            WupProxyDomainRouter a2 = WupProxyDomainRouter.a();
            StringBuilder sb2 = new StringBuilder();
            sb2.append(sb);
            sb2.append(this.I ? "wup_http2" : "wup");
            WupProxyDomainRouter.WupProxyAddress c2 = a2.c(sb2.toString());
            dnsData = DnsManager.getInstance().a(c2.f9963b, sb);
            if (dnsData != null) {
                dnsData.h = c2.f9964c;
            }
        } catch (Throwable unused) {
        }
        return dnsData;
    }

    private void m() {
        if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_94252789)) {
            if (this.mMttRequest != null) {
                NetEventMonitor.getInstance().group(this.G).setRequestContentLength(this.mMttRequest.hasHeader("Content-Length") ? this.mMttRequest.getHeader("Content-Length") : "");
            }
            if (this.mMttResponse != null) {
                NetEventMonitor.getInstance().group(this.G).setResponseContentLength("" + this.mMttResponse.getContentLength());
            }
        }
    }

    public byte[] a(boolean z, boolean z2) {
        byte[] bArr;
        GZIPInputStream gZIPInputStream;
        ByteArrayInputStream byteArrayInputStream;
        ByteArrayOutputStream byteArrayOutputStream;
        if (!z) {
            bArr = this.f10414b;
        } else if (this.f10414b == null || this.p == null) {
            FLogger.d("WUPTask", "getRawRspDataWithParam: try to dec, but data or key is null");
            bArr = null;
        } else {
            bArr = this.p.b(this.f10414b, this.u);
        }
        if (!z2 || bArr == null) {
            return bArr;
        }
        try {
            byteArrayInputStream = new ByteArrayInputStream(bArr);
            try {
                gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
                try {
                    byte[] bArr2 = new byte[1024];
                    byteArrayOutputStream = new ByteArrayOutputStream();
                    while (true) {
                        try {
                            int read = gZIPInputStream.read(bArr2, 0, bArr2.length);
                            if (read == -1) {
                                break;
                            }
                            byteArrayOutputStream.write(bArr2, 0, read);
                        } catch (Throwable unused) {
                            if (byteArrayOutputStream != null) {
                                try {
                                    byteArrayOutputStream.flush();
                                    byteArrayOutputStream.close();
                                } catch (Throwable unused2) {
                                    return null;
                                }
                            }
                            if (gZIPInputStream != null) {
                                gZIPInputStream.close();
                            }
                            if (byteArrayInputStream != null) {
                                byteArrayInputStream.close();
                            }
                            return null;
                        }
                    }
                    byte[] byteArray = byteArrayOutputStream.toByteArray();
                    byteArrayOutputStream.flush();
                    byteArrayOutputStream.close();
                    gZIPInputStream.close();
                    byteArrayInputStream.close();
                    try {
                        byteArrayOutputStream.flush();
                        byteArrayOutputStream.close();
                        gZIPInputStream.close();
                        byteArrayInputStream.close();
                    } catch (Throwable unused3) {
                    }
                    return byteArray;
                } catch (Throwable unused4) {
                    byteArrayOutputStream = null;
                }
            } catch (Throwable unused5) {
                gZIPInputStream = null;
                byteArrayOutputStream = null;
            }
        } catch (Throwable unused6) {
            gZIPInputStream = null;
            byteArrayInputStream = null;
            byteArrayOutputStream = null;
        }
    }

    public void addHeaders(Map<String, String> map) {
        if (this.mMttRequest != null) {
            this.mMttRequest.addHeaders(map);
        }
    }

    @Override
    public void cancel() {
        setMttResponse(null);
        this.f10416d = true;
        this.mStatus = (byte) 6;
    }

    @Override
    public void doRun() {
        long currentTimeMillis = System.currentTimeMillis();
        a(currentTimeMillis);
        IQBSpanProxy iQBSpanProxy = this.C;
        if (iQBSpanProxy != null) {
            iQBSpanProxy.addEvent("WUP_REQUEST_TASK_START", "threadWaitTime", "" + (currentTimeMillis - this.sendTime));
        }
        HttpTimeRecord.record(this.G, "wup_request_task_start", this.f10413a, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_task_start").build()).group(this.G).setRetryTimes(this.f10413a).setThreadPerformStartTime(SystemClock.currentThreadTimeMillis()).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        boolean isRetring = isRetring();
        this.mRunningState = (byte) 1;
        if (!isRetring) {
            c();
            this.mStatPath.add("wts");
        }
        if (this.f10413a < this.x && !this.f10416d) {
            if (!i()) {
                this.f10413a++;
                if (this.f10413a < this.x) {
                    this.mRunningState = (byte) 3;
                }
            }
            if (!this.y) {
                a();
            }
        }
        if (this.f10416d) {
            this.mStatus = (byte) 6;
        }
        if (this.mRunningState != 3) {
            this.mStatPath.add("wtd");
            this.mRunningState = (byte) 2;
        }
        long j = -1;
        if (isRetring()) {
            retry();
        } else {
            long currentTimeMillis2 = System.currentTimeMillis();
            HttpTimeRecord.record(this.G, "wup_request_handle_response_start", this.f10413a, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null, this.o, this.e);
            handleResponse();
            j = System.currentTimeMillis() - currentTimeMillis2;
        }
        b(currentTimeMillis);
        a(currentTimeMillis, j);
    }

    public void doRunAsync() {
        long currentTimeMillis = System.currentTimeMillis();
        this.F = true;
        HttpTimeRecord.record(this.G, "wup_request_task_start", this.f10413a, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null);
        NetEventMonitor.getInstance().stat(this.G, NetEvent.newBuilder().event("wup_request_task_start").build()).group(this.G).setRetryTimes(this.f10413a).setThreadPerformStartTime(SystemClock.currentThreadTimeMillis()).setFuncName(this.mMttRequest.getFuncName()).setServerName(this.mMttRequest.getServerName());
        boolean isRetring = isRetring();
        this.mRunningState = (byte) 1;
        if (!isRetring) {
            c();
            this.mStatPath.add("wts");
        }
        if (this.f10413a < this.x && !this.f10416d) {
            g();
            return;
        }
        if (this.f10416d) {
            this.mStatus = (byte) 6;
        }
        if (this.mRunningState != 3) {
            this.mStatPath.add("wtd");
            this.mRunningState = (byte) 2;
        }
        long j = -1;
        if (isRetring()) {
            retry();
        } else {
            long currentTimeMillis2 = System.currentTimeMillis();
            HttpTimeRecord.record(this.G, "wup_request_handle_response_start", this.f10413a, this.mMttRequest != null ? this.mMttRequest.getTag() : null, null, this.o, this.e);
            handleResponse();
            j = System.currentTimeMillis() - currentTimeMillis2;
        }
        a(currentTimeMillis, j);
    }

    public Object getBindObject() {
        return this.f;
    }

    public String getDnsIP() {
        DnsManager.DnsData dnsData = this.n;
        return dnsData == null ? "" : dnsData.f9936b;
    }

    public String getDnsType() {
        DnsManager.DnsData dnsData = this.n;
        return dnsData == null ? "" : dnsData.e;
    }

    public int getPacketSize() {
        return this.k;
    }

    public int getRespDataType() {
        if (this.J) {
            return 1;
        }
        return this.mRespDataType;
    }

    public byte[] getResponseData() {
        GZIPInputStream gZIPInputStream;
        ByteArrayInputStream byteArrayInputStream;
        ByteArrayOutputStream byteArrayOutputStream;
        byte[] bArr = this.m;
        if (bArr != null) {
            return bArr;
        }
        byte[] bArr2 = this.f10414b;
        this.m = bArr2;
        if (this.g) {
            if (bArr2 != null) {
                try {
                    if (this.p != null) {
                        this.m = this.p.b(bArr2, this.u);
                    }
                } catch (Throwable th) {
                    a("aes_dec_fail", th);
                    if (this.p != null && !TextUtils.isEmpty(this.q) && this.q.startsWith("tk=")) {
                        this.p.a(true);
                    }
                    this.m = null;
                }
            }
            FLogger.d("WUPTask", "getResponseData: try to dec, but data or key is null");
        }
        if (this.h) {
            byte[] bArr3 = this.m;
            try {
                if (bArr3 != null) {
                    try {
                        byteArrayInputStream = new ByteArrayInputStream(bArr3);
                        try {
                            gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
                            try {
                                byte[] bArr4 = new byte[1024];
                                byteArrayOutputStream = new ByteArrayOutputStream();
                                while (true) {
                                    try {
                                        int read = gZIPInputStream.read(bArr4, 0, bArr4.length);
                                        if (read == -1) {
                                            break;
                                        }
                                        byteArrayOutputStream.write(bArr4, 0, read);
                                    } catch (Throwable th2) {
                                        th = th2;
                                        try {
                                            a("rsp_ungzip_fail", th);
                                            this.m = null;
                                            if (byteArrayOutputStream != null) {
                                                byteArrayOutputStream.flush();
                                                byteArrayOutputStream.close();
                                            }
                                            if (gZIPInputStream != null) {
                                                gZIPInputStream.close();
                                            }
                                        } catch (Throwable th3) {
                                            if (byteArrayOutputStream != null) {
                                                try {
                                                    byteArrayOutputStream.flush();
                                                    byteArrayOutputStream.close();
                                                } catch (Throwable unused) {
                                                    throw th3;
                                                }
                                            }
                                            if (gZIPInputStream != null) {
                                                gZIPInputStream.close();
                                            }
                                            if (byteArrayInputStream != null) {
                                                byteArrayInputStream.close();
                                            }
                                            throw th3;
                                        }
                                    }
                                }
                                this.m = byteArrayOutputStream.toByteArray();
                                byteArrayOutputStream.flush();
                                byteArrayOutputStream.close();
                                gZIPInputStream.close();
                            } catch (Throwable th4) {
                                th = th4;
                                byteArrayOutputStream = null;
                            }
                        } catch (Throwable th5) {
                            th = th5;
                            gZIPInputStream = null;
                            byteArrayOutputStream = null;
                        }
                    } catch (Throwable th6) {
                        th = th6;
                        gZIPInputStream = null;
                        byteArrayInputStream = null;
                        byteArrayOutputStream = null;
                    }
                    byteArrayInputStream.close();
                }
            } catch (Throwable unused2) {
            }
        }
        return this.m;
    }

    public IQBSpanProxy getSpanProxy() {
        return this.C;
    }

    public ArrayList<String> getStatPath() {
        return this.mStatPath;
    }

    @Override
    public String getTaskUrl() {
        return this.e;
    }

    public String getTaskUrlBeforeDns() {
        return this.o;
    }

    public int getUniqueId() {
        return this.G;
    }

    @Override
    public void handleResponse() {
        if (this.mMttRequest != null) {
            NetEventMonitor.getInstance().group(this.G).setConnectionType(this.mMttRequest.getIsTbsNetRequest() ? com.example.tbsnetexport.BuildConfig.FLAVOR : "ok3");
        }
        fireObserverEvent(this.mStatus);
        finish("done");
    }

    public boolean hasSetServer() {
        return this.l;
    }

    public boolean isPbproxy() {
        return this.J;
    }

    public boolean isRespFromTestServer() {
        return this.v;
    }

    @Override
    public void onIntercept(HttpURLConnection httpURLConnection) {
        IWUPClientProxy publicWUPProxy = WUPProxyHolder.getPublicWUPProxy();
        boolean z = false;
        if ((publicWUPProxy != null ? publicWUPProxy.getBooleanConfiguration(IWUPClientProxy.KEY_ANDROID_WUP_USE_NEW_OKHTTP_CONNECTION_CACHE, false) : false) || httpURLConnection == null || !this.z) {
            return;
        }
        WupConnectionPool d2 = this.A.d();
        if (d2 != null && d2.a()) {
            z = d2.a(httpURLConnection);
        }
        if (z) {
            return;
        }
        setConnectionClose();
    }

    @Override
    public void run() {
        doRun();
    }

    public void setBindObject(Object obj) {
        this.f = obj;
        if (obj instanceof WUPRequestBase) {
            WUPRequestBase wUPRequestBase = (WUPRequestBase) obj;
            if (this.mMttRequest != null) {
                String serverName = wUPRequestBase.getServerName();
                String funcName = wUPRequestBase.getFuncName();
                this.mMttRequest.setTag(serverName + "/" + funcName);
                if (!TextUtils.isEmpty(serverName)) {
                    this.mMttRequest.setServerName(serverName);
                }
                if (TextUtils.isEmpty(funcName)) {
                    return;
                }
                this.mMttRequest.setFuncName(funcName);
            }
        }
    }

    public void setKeepAliveEnable(boolean z) {
        IWUPClientProxy publicWUPProxy = WUPProxyHolder.getPublicWUPProxy();
        boolean z2 = false;
        if (!(publicWUPProxy != null ? publicWUPProxy.getBooleanConfiguration(IWUPClientProxy.KEY_ANDROID_WUP_USE_NEW_OKHTTP_CONNECTION_CACHE, false) : false)) {
            if (z && this.A.d().a()) {
                z2 = true;
            }
            this.z = z2;
        }
    }

    public void setPacketSize(int i) {
        this.k = i;
    }

    public void setRequestID(int i) {
        if (this.mMttRequest != null) {
            this.mMttRequest.setRequestID(i);
        }
    }

    public void setRequestPolicy(RequestPolicy requestPolicy) {
        this.w = requestPolicy;
    }

    public void setSpanProxy(IQBSpanProxy iQBSpanProxy) {
        this.C = iQBSpanProxy;
    }

    public void setUniqueId(int i) {
        this.G = i;
        if (this.mMttRequest != null) {
            this.mMttRequest.setUniqueId(i);
        }
    }

    public void setUrl(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.l = true;
        MttRequestBase mttRequestBase = this.mMttRequest;
        this.e = str;
        mttRequestBase.setUrl(str);
        this.I = false;
    }
}