밤친구 v4.7.3版本的 MD5 值为:a58175795b36d9d722726efa7eb4c52a

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


package ce;

import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import com.huawei.hms.framework.common.ContainerUtils;
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.URLEncoder;
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.StandardCharsets;
import java.nio.charset.UnmappableCharacterException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InvalidPropertiesFormatException;
import java.util.UUID;
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 qh.v0;
import rk.c0;
import rk.t;
import rk.u;
import rk.v;
import rk.x;
import rk.y;

public final class b {

    public static class a extends Exception {
        public a(int i) {
            super(ac.d.f("http status code error:", i));
        }
    }

    public static class C0037b extends Exception {
        public C0037b() {
            super("network unavailable");
        }
    }

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

    public static zd.b b(String str, String str2, Bundle bundle) throws IOException {
        Bundle bundle2;
        Bundle bundle3;
        if (bundle != null) {
            bundle2 = new Bundle(bundle);
        } else {
            bundle2 = new Bundle();
        }
        boolean z10 = false;
        if (str2.equalsIgnoreCase("GET")) {
            HashMap a10 = a(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")) {
                z10 = true;
            }
            if (!z10) {
                bundle3 = bundle2;
            } else {
                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");
            }
            if (bundle3 != bundle2) {
                be.a.f("openSDK_LOG.HttpUtils", "-->openUrl encodedParam =" + bundle3.toString() + " -- url = " + str);
            } else {
                be.a.f("openSDK_LOG.HttpUtils", "-->openUrl encodedParam =" + a10.toString() + " -- url = " + str);
            }
            return zd.a.a().c(str, a10);
        }
        if (str2.equalsIgnoreCase("POST")) {
            HashMap a11 = a(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 zd.a.a().d(str, a11);
            }
            be.a.i("openSDK_LOG.HttpUtils", "openUrl: has binary " + hashMap.size());
            zd.a a12 = zd.a.a();
            a12.getClass();
            if (hashMap.size() == 0) {
                return a12.d(str, a11);
            }
            be.a.f("openSDK_LOG.OpenHttpService", "post data, has byte data");
            String uuid = UUID.randomUUID().toString();
            t tVar = u.f16162e;
            ArrayList arrayList = new ArrayList();
            cl.i d4 = cl.i.d(uuid);
            if (a11.size() > 0) {
                for (String str4 : a11.keySet()) {
                    String str5 = (String) a11.get(str4);
                    if (str5 != null) {
                        arrayList.add(u.b.b(str4, null, c0.c(null, str5.getBytes(StandardCharsets.UTF_8))));
                    }
                }
            }
            for (String str6 : hashMap.keySet()) {
                byte[] bArr = (byte[]) hashMap.get(str6);
                if (bArr != null && bArr.length > 0) {
                    arrayList.add(u.b.b(str6, str6, c0.c(t.b("content/unknown"), bArr)));
                    be.a.i("openSDK_LOG.OpenHttpService", "post byte data.");
                }
            }
            if (!arrayList.isEmpty()) {
                u uVar = new u(d4, tVar, arrayList);
                y.a aVar = new y.a();
                aVar.e(str);
                aVar.b("POST", uVar);
                y a13 = aVar.a();
                v vVar = a12.f18917a;
                vVar.getClass();
                return new zd.b(x.c(vVar, a13, false).execute(), (int) uVar.a());
            }
            throw new IllegalStateException("Multipart body must have at least one part.");
        }
        be.a.c("openSDK_LOG.HttpUtils", "openUrl: http method " + str2 + " is not supported.");
        throw new IOException("http method is not supported.");
    }

    public static String c(HashMap hashMap) {
        if (hashMap.size() == 0) {
            return "";
        }
        StringBuilder sb2 = new StringBuilder();
        boolean z10 = true;
        for (String str : hashMap.keySet()) {
            if (z10) {
                z10 = false;
            } else {
                sb2.append(ContainerUtils.FIELD_DELIMITER);
            }
            sb2.append(URLEncoder.encode(str));
            sb2.append(ContainerUtils.KEY_VALUE_DELIMITER);
            sb2.append(URLEncoder.encode((String) hashMap.get(str)));
        }
        return sb2.toString();
    }

    public static int d(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;
        }
        if (iOException instanceof ZipException) {
            return -54;
        }
        return -2;
    }

    public static void e(ud.f fVar, Context context, String str, Bundle bundle, String str2) throws IOException, JSONException, C0037b, a {
        String str3;
        String str4;
        int i;
        long j10;
        long j11;
        int i2;
        be.a.f("openSDK_LOG.HttpUtils", "OpenApi request");
        if (l.n(context)) {
            if (!str.toLowerCase().startsWith("http")) {
                str3 = i.a().b(context, "https://openmobile.qq.com/") + str;
                str4 = i.a().b(context, "https://openmobile.qq.com/") + str;
            } else {
                str3 = str;
                str4 = str3;
            }
            int i10 = 0;
            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) {
                v0.y(context, fVar, str);
            }
            long elapsedRealtime = SystemClock.elapsedRealtime();
            int a10 = h.b(context, fVar.f16922a).a("Common_HttpRetryCount");
            StringBuilder n10 = androidx.appcompat.widget.g.n("config 1:Common_HttpRetryCount            config_value:", a10, "   appid:");
            String str5 = fVar.f16922a;
            n10.append(str5);
            n10.append("     url:");
            n10.append(str4);
            be.a.h("OpenConfig_test", n10.toString());
            if (a10 == 0) {
                a10 = 3;
            }
            be.a.h("OpenConfig_test", "config 1:Common_HttpRetryCount            result_value:" + a10 + "   appid:" + str5 + "     url:" + str4);
            long j12 = elapsedRealtime;
            while (true) {
                int i11 = i10 + 1;
                try {
                    try {
                        zd.b b10 = b(str3, str2, bundle);
                        int i12 = b10.f18922c;
                        be.a.f("openSDK_LOG.HttpUtils", "request statusCode " + i12);
                        if (i12 == 200) {
                            try {
                                i2 = l.s(b10.a()).getInt("ret");
                            } catch (JSONException unused) {
                                i2 = -4;
                            }
                            long j13 = b10.f18923d;
                            j11 = b10.f18924e;
                            i = i2;
                            j10 = j13;
                        } else {
                            ae.h.b().d(str4, j12, 0L, 0L, i12);
                            throw new a(i12);
                        }
                    } catch (JSONException e10) {
                        e10.printStackTrace();
                        ae.h.b().d(str4, j12, 0L, 0L, -4);
                        throw e10;
                    }
                } catch (MalformedURLException e11) {
                    e11.printStackTrace();
                    ae.h.b().d(str4, j12, 0L, 0L, -3);
                    throw e11;
                } catch (SocketTimeoutException e12) {
                    e12.printStackTrace();
                    i = -8;
                    j10 = 0;
                    j11 = 0;
                    if (i11 < a10) {
                        j12 = SystemClock.elapsedRealtime();
                        if (i11 >= a10) {
                            break;
                        } else {
                            i10 = i11;
                        }
                    } else {
                        ae.h.b().d(str4, j12, 0L, 0L, -8);
                        throw e12;
                    }
                } catch (IOException e13) {
                    e13.printStackTrace();
                    ae.h.b().d(str4, j12, 0L, 0L, d(e13));
                    throw e13;
                }
            }
            ae.h.b().d(str4, j12, j10, j11, i);
            return;
        }
        throw new C0037b();
    }
}