MT Manager v2.15.3版本的 MD5 值为:27f0d62ac7123fbbaefff319fdab9f13

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


package l;

import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import com.alipay.sdk.m.l.a;
import java.io.CharConversionException;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.InvalidObjectException;
import java.io.NotActiveException;
import java.io.NotSerializableException;
import java.io.OptionalDataException;
import java.io.StreamCorruptedException;
import java.io.SyncFailedException;
import java.io.UTFDataFormatException;
import java.io.UnsupportedEncodingException;
import java.io.WriteAbortedException;
import java.net.BindException;
import java.net.ConnectException;
import java.net.HttpRetryException;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.PortUnreachableException;
import java.net.ProtocolException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.net.UnknownServiceException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileLockInterruptionException;
import java.nio.charset.MalformedInputException;
import java.nio.charset.UnmappableCharacterException;
import java.util.HashMap;
import java.util.InvalidPropertiesFormatException;
import java.util.Map;
import java.util.concurrent.RejectedExecutionException;
import java.util.zip.ZipException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLKeyException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLProtocolException;
import org.json.JSONException;
import org.json.JSONObject;

public final class C1154 {
    public static JSONObject m3705(C1904 c1904, Context context, String str, Bundle bundle, String str2) {
        String str3;
        String str4;
        String str5;
        int i;
        int i2;
        long j;
        long j2;
        InterfaceC11586 m3704;
        int i3;
        String str6 = "openSDK_LOG.HttpUtils";
        C10884.m24184("openSDK_LOG.HttpUtils", "OpenApi request");
        if (!C11305.m24722(context)) {
            throw new Exception("network unavailable");
        }
        if (str.toLowerCase().startsWith(a.r)) {
            str3 = str;
            str4 = str3;
        } else {
            str3 = C14673.m30707().m30708(context, "https://openmobile.qq.com/") + str;
            str4 = C14673.m30707().m30708(context, "https://openmobile.qq.com/") + str;
        }
        if (str.indexOf("add_share") > -1 || str.indexOf("upload_pic") > -1 || str.indexOf("add_topic") > -1 || str.indexOf("set_user_face") > -1 || str.indexOf("add_t") > -1 || str.indexOf("add_pic_t") > -1 || str.indexOf("add_pic_url") > -1 || str.indexOf("add_video") > -1) {
            C7291.m17426(context, c1904, str);
        }
        long elapsedRealtime = SystemClock.elapsedRealtime();
        int m18878 = C7936.m18872(context, c1904.m5614()).m18878("Common_HttpRetryCount");
        StringBuilder m23462 = C10499.m23462("config 1:Common_HttpRetryCount            config_value:", m18878, "   appid:");
        m23462.append(c1904.m5614());
        m23462.append("     url:");
        m23462.append(str4);
        C10884.m24178("OpenConfig_test", m23462.toString());
        int i4 = m18878 == 0 ? 3 : m18878;
        StringBuilder m234622 = C10499.m23462("config 1:Common_HttpRetryCount            result_value:", i4, "   appid:");
        m234622.append(c1904.m5614());
        m234622.append("     url:");
        m234622.append(str4);
        C10884.m24178("OpenConfig_test", m234622.toString());
        int i5 = 0;
        JSONObject jSONObject = null;
        long j3 = elapsedRealtime;
        while (true) {
            int i6 = i5 + 1;
            try {
                try {
                    try {
                        m3704 = m3704(str3, str2, bundle);
                        int d = m3704.d();
                        C10884.m24184(str6, "request statusCode " + d);
                        if (d == 200) {
                            break;
                        }
                        C6673.m16222().getClass();
                        str5 = str6;
                        i = i6;
                        try {
                            C6673.m16218(str4, j3, 0L, 0L, d);
                            throw new C6206(d);
                            break;
                        } catch (SocketTimeoutException e) {
                            e = e;
                            i2 = -8;
                            j2 = 0;
                            j = 0;
                            if (i < i4) {
                                j3 = SystemClock.elapsedRealtime();
                                if (i >= i4) {
                                    C6673.m16222().getClass();
                                    C6673.m16218(str4, j3, j2, j, i2);
                                    return jSONObject;
                                }
                                i5 = i;
                                str6 = str5;
                            } else {
                                C6673.m16222().getClass();
                                C6673.m16218(str4, j3, 0L, 0L, -8);
                                throw e;
                            }
                        }
                    } catch (SocketTimeoutException e2) {
                        e = e2;
                        str5 = str6;
                        i = i6;
                    }
                    i5 = i;
                    str6 = str5;
                } catch (JSONException e3) {
                    C6673.m16222().getClass();
                    C6673.m16218(str4, j3, 0L, 0L, -4);
                    throw e3;
                }
            } catch (MalformedURLException e4) {
                C6673.m16222().getClass();
                C6673.m16218(str4, j3, 0L, 0L, -3);
                throw e4;
            } catch (IOException e5) {
                int m3702 = m3702(e5);
                C6673.m16222().getClass();
                C6673.m16218(str4, j3, 0L, 0L, m3702);
                throw e5;
            }
        }
        C6673.m16222().getClass();
        C6673.m16218(str4, j3, j2, j, i2);
        return jSONObject;
        long c = m3704.c();
        j = m3704.b();
        i2 = i3;
        j2 = c;
        C6673.m16222().getClass();
        C6673.m16218(str4, j3, j2, j, i2);
        return jSONObject;
    }

    public static void m3706(C1904 c1904, Context context, String str, Bundle bundle, String str2, C3914 c3914) {
        C10884.m24184("openSDK_LOG.HttpUtils", "OpenApi requestAsync");
        try {
            C1200.f5164.execute(new RunnableC1996(c1904, context, str, bundle, str2, c3914));
        } catch (RejectedExecutionException unused) {
        }
    }

    public static int m3702(IOException iOException) {
        if (iOException instanceof CharConversionException) {
            return -20;
        }
        if (iOException instanceof MalformedInputException) {
            return -21;
        }
        if (iOException instanceof UnmappableCharacterException) {
            return -22;
        }
        if (iOException instanceof ClosedChannelException) {
            return -24;
        }
        if (iOException instanceof EOFException) {
            return -26;
        }
        if (iOException instanceof FileLockInterruptionException) {
            return -27;
        }
        if (iOException instanceof FileNotFoundException) {
            return -28;
        }
        if (iOException instanceof HttpRetryException) {
            return -29;
        }
        if (iOException instanceof SocketTimeoutException) {
            return -8;
        }
        if (iOException instanceof InvalidPropertiesFormatException) {
            return -30;
        }
        if (iOException instanceof MalformedURLException) {
            return -3;
        }
        if (iOException instanceof InvalidClassException) {
            return -33;
        }
        if (iOException instanceof InvalidObjectException) {
            return -34;
        }
        if (iOException instanceof NotActiveException) {
            return -35;
        }
        if (iOException instanceof NotSerializableException) {
            return -36;
        }
        if (iOException instanceof OptionalDataException) {
            return -37;
        }
        if (iOException instanceof StreamCorruptedException) {
            return -38;
        }
        if (iOException instanceof WriteAbortedException) {
            return -39;
        }
        if (iOException instanceof ProtocolException) {
            return -40;
        }
        if (iOException instanceof SSLHandshakeException) {
            return -41;
        }
        if (iOException instanceof SSLKeyException) {
            return -42;
        }
        if (iOException instanceof SSLPeerUnverifiedException) {
            return -43;
        }
        if (iOException instanceof SSLProtocolException) {
            return -44;
        }
        if (iOException instanceof BindException) {
            return -45;
        }
        if (iOException instanceof ConnectException) {
            return -46;
        }
        if (iOException instanceof NoRouteToHostException) {
            return -47;
        }
        if (iOException instanceof PortUnreachableException) {
            return -48;
        }
        if (iOException instanceof SyncFailedException) {
            return -49;
        }
        if (iOException instanceof UTFDataFormatException) {
            return -50;
        }
        if (iOException instanceof UnknownHostException) {
            return -51;
        }
        if (iOException instanceof UnknownServiceException) {
            return -52;
        }
        if (iOException instanceof UnsupportedEncodingException) {
            return -53;
        }
        return iOException instanceof ZipException ? -54 : -2;
    }

    public static InterfaceC11586 m3704(String str, String str2, Bundle bundle) {
        Bundle bundle2;
        Bundle bundle3;
        if (bundle != null) {
            bundle2 = new Bundle(bundle);
        } else {
            bundle2 = new Bundle();
        }
        if (str2.equalsIgnoreCase("GET")) {
            HashMap m3703 = m3703(bundle2);
            if (bundle2.containsKey("access_token") || bundle2.containsKey("pay_token") || bundle2.containsKey("pfkey") || bundle2.containsKey("expires_in") || bundle2.containsKey("openid") || bundle2.containsKey("proxy_code") || bundle2.containsKey("proxy_expires_in")) {
                bundle3 = new Bundle(bundle2);
                bundle3.remove("access_token");
                bundle3.remove("pay_token");
                bundle3.remove("pfkey");
                bundle3.remove("expires_in");
                bundle3.remove("openid");
                bundle3.remove("proxy_code");
                bundle3.remove("proxy_expires_in");
            } else {
                bundle3 = bundle2;
            }
            if (bundle3 != bundle2) {
                C10884.m24184("openSDK_LOG.HttpUtils", "-->openUrl encodedParam =" + bundle3.toString() + " -- url = " + str);
            } else {
                C10884.m24184("openSDK_LOG.HttpUtils", "-->openUrl encodedParam =" + m3703.toString() + " -- url = " + str);
            }
            return C7375.m17569().m17573(str, (Map) m3703);
        }
        if (str2.equalsIgnoreCase("POST")) {
            HashMap m37032 = m3703(bundle2);
            HashMap hashMap = new HashMap(0);
            if (bundle2.size() != 0) {
                for (String str3 : bundle2.keySet()) {
                    Object obj = bundle2.get(str3);
                    if (obj instanceof byte[]) {
                        hashMap.put(str3, (byte[]) obj);
                    }
                }
            }
            if (hashMap.size() == 0) {
                return C7375.m17569().m17571(str, m37032);
            }
            C10884.m24179("openSDK_LOG.HttpUtils", "openUrl: has binary " + hashMap.size());
            return C7375.m17569().m17572(str, m37032, hashMap);
        }
        C10884.m24182("openSDK_LOG.HttpUtils", "openUrl: http method " + str2 + " is not supported.");
        throw new IOException("http method is not supported.");
    }

    public static String m3707(Bundle bundle) {
        HashMap m3703 = m3703(bundle);
        if (m3703.size() == 0) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        boolean z = true;
        for (String str : m3703.keySet()) {
            if (z) {
                z = false;
            } else {
                sb.append(com.alipay.sdk.m.s.a.n);
            }
            sb.append(C9981.encode(str));
            sb.append("=");
            sb.append(C9981.encode((String) m3703.get(str)));
        }
        return sb.toString();
    }

    public static HashMap m3703(Bundle bundle) {
        HashMap hashMap = new HashMap();
        if (bundle.size() == 0) {
            return hashMap;
        }
        for (String str : bundle.keySet()) {
            Object obj = bundle.get(str);
            if (!(obj instanceof String) && !(obj instanceof String[])) {
                C10884.m24179("openSDK_LOG.HttpUtils", "parseBundleToMap: the type " + obj.getClass() + " is unsupported");
            } else if (obj instanceof String[]) {
                String[] strArr = (String[]) obj;
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < strArr.length; i++) {
                    if (i != 0) {
                        sb.append(",");
                    }
                    sb.append(strArr[i]);
                }
                hashMap.put(str, sb.toString());
            } else {
                hashMap.put(str, (String) obj);
            }
        }
        return hashMap;
    }
}