卡特世界 v1.0.8版本的 MD5 值为:003518196b64b6d0c6e5f7f4996f7146

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


package com.beizi.fusion.g;

import android.content.Context;
import android.os.Build;
import android.os.Debug;
import android.text.TextUtils;
import com.baidu.mobads.sdk.internal.bk;
import com.beizi.fusion.d.a.b;
import com.beizi.fusion.model.DevInfo;
import com.beizi.fusion.model.EnvInfo;
import com.beizi.fusion.model.JsonResolver;
import com.beizi.fusion.model.RequestInfo;
import com.beizi.fusion.model.ResponseInfo;
import com.beizi.fusion.model.S2SBiddingConfig;
import com.bumptech.glide.load.Key;
import com.kwad.components.offline.api.tk.model.report.TKDownloadReason;
import com.kwad.sdk.core.imageloader.core.download.BaseImageDownloader;
import com.sigmob.sdk.base.mta.PointCategory;
import com.sigmob.windad.WindAds;
import com.ss.android.socialbase.downloader.utils.DownloadUtils;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONObject;
public class aa {
    private static String a = "HttpUtil";

    public static String a(String str, String str2) {
        HttpURLConnection httpURLConnection;
        BufferedReader bufferedReader;
        HttpURLConnection httpURLConnection2;
        BufferedReader bufferedReader2;
        BufferedReader bufferedReader3;
        HttpURLConnection httpURLConnection3;
        int responseCode;
        InputStream stringBuffer = new StringBuffer();
        try {
            try {
                try {
                    httpURLConnection3 = (HttpURLConnection) new URL(str).openConnection();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } catch (Exception e2) {
                e = e2;
                httpURLConnection2 = null;
                bufferedReader2 = null;
            } catch (Throwable th) {
                th = th;
                httpURLConnection = null;
                bufferedReader = null;
            }
            try {
                httpURLConnection3.setRequestMethod("GET");
                httpURLConnection3.setConnectTimeout(10000);
                httpURLConnection3.setReadTimeout(5000);
                httpURLConnection3.setUseCaches(false);
                if (!TextUtils.isEmpty(str2)) {
                    httpURLConnection3.setRequestProperty("User-Agent", str2);
                }
                httpURLConnection3.setChunkedStreamingMode(0);
                httpURLConnection3.setRequestProperty("Connection", PointCategory.CLOSE);
                httpURLConnection3.setDoInput(true);
                httpURLConnection3.connect();
                responseCode = httpURLConnection3.getResponseCode();
                ae.a(a, "get code:" + responseCode);
            } catch (Exception e3) {
                e = e3;
                bufferedReader2 = null;
                httpURLConnection2 = httpURLConnection3;
                bufferedReader3 = bufferedReader2;
                stringBuffer = bufferedReader2;
                str = httpURLConnection2;
                e.printStackTrace();
                if (bufferedReader3 != null) {
                }
                if (stringBuffer != 0) {
                }
                if (str != 0) {
                }
                return null;
            } catch (Throwable th2) {
                th = th2;
                bufferedReader = null;
                httpURLConnection = httpURLConnection3;
                bufferedReader3 = bufferedReader;
                stringBuffer = bufferedReader;
                str = httpURLConnection;
                th.printStackTrace();
                if (bufferedReader3 != null) {
                }
                if (stringBuffer != 0) {
                }
                if (str != null) {
                }
                return null;
            }
            if (responseCode != 200) {
                if (httpURLConnection3 != null) {
                    httpURLConnection3.disconnect();
                }
                return null;
            }
            InputStream inputStream = httpURLConnection3.getInputStream();
            try {
                bufferedReader3 = new BufferedReader(new InputStreamReader(inputStream));
                while (true) {
                    try {
                        String readLine = bufferedReader3.readLine();
                        if (readLine == null) {
                            break;
                        }
                        stringBuffer.append(readLine);
                    } catch (Exception e4) {
                        e = e4;
                        Exception exc = e;
                        stringBuffer = inputStream;
                        e = exc;
                        str = httpURLConnection3;
                        e.printStackTrace();
                        if (bufferedReader3 != null) {
                            bufferedReader3.close();
                        }
                        if (stringBuffer != 0) {
                            stringBuffer.close();
                        }
                        if (str != 0) {
                            str.disconnect();
                        }
                        return null;
                    } catch (Throwable th3) {
                        th = th3;
                        Throwable th4 = th;
                        stringBuffer = inputStream;
                        th = th4;
                        str = httpURLConnection3;
                        th.printStackTrace();
                        if (bufferedReader3 != null) {
                            bufferedReader3.close();
                        }
                        if (stringBuffer != 0) {
                            stringBuffer.close();
                        }
                        if (str != null) {
                            str.disconnect();
                        }
                        return null;
                    }
                }
                String stringBuffer2 = stringBuffer.toString();
                try {
                    bufferedReader3.close();
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (httpURLConnection3 != null) {
                        httpURLConnection3.disconnect();
                    }
                } catch (IOException e5) {
                    e5.printStackTrace();
                }
                return stringBuffer2;
            } catch (Exception e6) {
                e = e6;
                bufferedReader3 = null;
            } catch (Throwable th5) {
                th = th5;
                bufferedReader3 = null;
            }
        } catch (Throwable th6) {
            if (bufferedReader3 != null) {
                try {
                    bufferedReader3.close();
                } catch (IOException e7) {
                    e7.printStackTrace();
                    throw th6;
                }
            }
            if (stringBuffer != 0) {
                stringBuffer.close();
            }
            if (str != 0) {
                str.disconnect();
            }
            throw th6;
        }
    }

    public static String a(String str, byte[] bArr) {
        HttpURLConnection httpURLConnection;
        InputStream inputStream;
        HttpURLConnection httpURLConnection2;
        InputStream inputStream2;
        InputStreamReader inputStreamReader;
        BufferedReader bufferedReader;
        HttpURLConnection httpURLConnection3;
        OutputStream outputStream;
        InputStream inputStream3;
        HttpURLConnection httpURLConnection4;
        HttpURLConnection httpURLConnection5;
        OutputStream outputStream2;
        BufferedReader bufferedReader2;
        OutputStream outputStream3;
        InputStream inputStream4;
        BufferedReader bufferedReader3;
        OutputStream outputStream4;
        InputStream inputStream5;
        BufferedReader bufferedReader4;
        InputStream inputStream6;
        BufferedReader bufferedReader5;
        InputStream inputStream7;
        try {
            try {
                try {
                    httpURLConnection5 = (HttpURLConnection) new URL(str).openConnection();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                try {
                    httpURLConnection5.setRequestMethod(com.baidu.mobads.sdk.internal.an.b);
                    httpURLConnection5.setRequestProperty(DownloadUtils.CONTENT_LENGTH, String.valueOf(bArr.length));
                    httpURLConnection5.setRequestProperty(DownloadUtils.CONTENT_TYPE, com.baidu.mobads.sdk.internal.an.d);
                    httpURLConnection5.setConnectTimeout(BaseImageDownloader.DEFAULT_HTTP_READ_TIMEOUT);
                    httpURLConnection5.setReadTimeout(BaseImageDownloader.DEFAULT_HTTP_READ_TIMEOUT);
                    httpURLConnection5.setDoOutput(true);
                    httpURLConnection5.setDoInput(true);
                    httpURLConnection5.connect();
                    if (bArr.length > 0) {
                        OutputStream outputStream5 = httpURLConnection5.getOutputStream();
                        try {
                            outputStream5.write(bArr);
                            outputStream2 = outputStream5;
                        } catch (Exception e2) {
                            e = e2;
                            inputStreamReader = null;
                            bufferedReader = 0;
                            outputStream = outputStream2;
                            inputStream3 = null;
                            httpURLConnection4 = httpURLConnection5;
                            e.printStackTrace();
                            str = httpURLConnection4;
                            if (inputStream3 != null) {
                            }
                            if (outputStream != 0) {
                            }
                            return null;
                        } catch (Throwable th) {
                            th = th;
                            inputStreamReader = null;
                            bufferedReader = 0;
                            outputStream = outputStream2;
                            inputStream3 = null;
                            httpURLConnection3 = httpURLConnection5;
                            th.printStackTrace();
                            str = httpURLConnection3;
                            if (inputStream3 != null) {
                            }
                            if (outputStream != 0) {
                            }
                            return null;
                        }
                    } else {
                        outputStream2 = null;
                    }
                    outputStream = 200;
                } catch (Exception e3) {
                    e = e3;
                    inputStream2 = null;
                    httpURLConnection2 = httpURLConnection5;
                    InputStream inputStream8 = inputStream2;
                    inputStreamReader = inputStream8;
                    bufferedReader = inputStreamReader;
                    inputStream3 = inputStream2;
                    outputStream = inputStream8;
                    httpURLConnection4 = httpURLConnection2;
                    e.printStackTrace();
                    str = httpURLConnection4;
                    if (inputStream3 != null) {
                    }
                    if (outputStream != 0) {
                    }
                    return null;
                } catch (Throwable th2) {
                    th = th2;
                    inputStream = null;
                    httpURLConnection = httpURLConnection5;
                    InputStream inputStream9 = inputStream;
                    inputStreamReader = inputStream9;
                    bufferedReader = inputStreamReader;
                    inputStream3 = inputStream;
                    outputStream = inputStream9;
                    httpURLConnection3 = httpURLConnection;
                    th.printStackTrace();
                    str = httpURLConnection3;
                    if (inputStream3 != null) {
                    }
                    if (outputStream != 0) {
                    }
                    return null;
                }
            } catch (Exception e4) {
                e = e4;
                httpURLConnection2 = null;
                inputStream2 = null;
            } catch (Throwable th3) {
                th = th3;
                httpURLConnection = null;
                inputStream = null;
            }
            if (httpURLConnection5.getResponseCode() != 200) {
                if (outputStream2 != null) {
                    outputStream2.close();
                    inputStream3 = outputStream2;
                    str = httpURLConnection5;
                }
                return null;
            }
            InputStream inputStream10 = httpURLConnection5.getInputStream();
            try {
                InputStreamReader inputStreamReader2 = new InputStreamReader(inputStream10);
                try {
                    BufferedReader bufferedReader6 = new BufferedReader(inputStreamReader2);
                    try {
                        StringBuffer stringBuffer = new StringBuffer();
                        while (true) {
                            String readLine = bufferedReader6.readLine();
                            if (readLine == null) {
                                break;
                            }
                            stringBuffer.append(readLine);
                        }
                        String stringBuffer2 = stringBuffer.toString();
                        if (inputStream10 != null) {
                            try {
                                inputStream10.close();
                                inputStreamReader2.close();
                                bufferedReader6.close();
                                httpURLConnection5.disconnect();
                            } catch (IOException e5) {
                                e5.printStackTrace();
                            }
                        }
                        if (outputStream2 != null) {
                            try {
                                outputStream2.close();
                            } catch (IOException e6) {
                                e6.printStackTrace();
                            }
                        }
                        return stringBuffer2;
                    } catch (Exception e7) {
                        outputStream4 = outputStream2;
                        inputStream7 = inputStream10;
                        e = e7;
                        bufferedReader5 = bufferedReader6;
                        inputStreamReader = inputStreamReader2;
                        inputStream5 = inputStream7;
                        bufferedReader3 = bufferedReader5;
                        outputStream = outputStream4;
                        inputStream3 = inputStream5;
                        bufferedReader = bufferedReader3;
                        httpURLConnection4 = httpURLConnection5;
                        e.printStackTrace();
                        str = httpURLConnection4;
                        if (inputStream3 != null) {
                            try {
                                inputStream3.close();
                                if (inputStreamReader != null) {
                                    inputStreamReader.close();
                                }
                                if (bufferedReader != 0) {
                                    bufferedReader.close();
                                }
                                httpURLConnection4.disconnect();
                                str = httpURLConnection4;
                            } catch (IOException e8) {
                                e8.printStackTrace();
                                str = e8;
                            }
                        }
                        if (outputStream != 0) {
                            outputStream.close();
                            inputStream3 = inputStream3;
                            outputStream = outputStream;
                            bufferedReader = bufferedReader;
                            str = str;
                        }
                        return null;
                    } catch (Throwable th4) {
                        outputStream3 = outputStream2;
                        inputStream6 = inputStream10;
                        th = th4;
                        bufferedReader4 = bufferedReader6;
                        inputStreamReader = inputStreamReader2;
                        inputStream4 = inputStream6;
                        bufferedReader2 = bufferedReader4;
                        outputStream = outputStream3;
                        inputStream3 = inputStream4;
                        bufferedReader = bufferedReader2;
                        httpURLConnection3 = httpURLConnection5;
                        th.printStackTrace();
                        str = httpURLConnection3;
                        if (inputStream3 != null) {
                            try {
                                inputStream3.close();
                                if (inputStreamReader != null) {
                                    inputStreamReader.close();
                                }
                                if (bufferedReader != 0) {
                                    bufferedReader.close();
                                }
                                httpURLConnection3.disconnect();
                                str = httpURLConnection3;
                            } catch (IOException e9) {
                                e9.printStackTrace();
                                str = e9;
                            }
                        }
                        if (outputStream != 0) {
                            outputStream.close();
                            inputStream3 = inputStream3;
                            outputStream = outputStream;
                            bufferedReader = bufferedReader;
                            str = str;
                        }
                        return null;
                    }
                } catch (Exception e10) {
                    bufferedReader5 = null;
                    outputStream4 = outputStream2;
                    inputStream7 = inputStream10;
                    e = e10;
                } catch (Throwable th5) {
                    bufferedReader4 = null;
                    outputStream3 = outputStream2;
                    inputStream6 = inputStream10;
                    th = th5;
                }
            } catch (Exception e11) {
                inputStreamReader = null;
                bufferedReader3 = null;
                outputStream4 = outputStream2;
                inputStream5 = inputStream10;
                e = e11;
            } catch (Throwable th6) {
                inputStreamReader = null;
                bufferedReader2 = null;
                outputStream3 = outputStream2;
                inputStream4 = inputStream10;
                th = th6;
            }
        } catch (Throwable th7) {
            if (inputStream3 != null) {
                try {
                    inputStream3.close();
                    if (inputStreamReader != null) {
                        inputStreamReader.close();
                    }
                    if (bufferedReader != 0) {
                        bufferedReader.close();
                    }
                    str.disconnect();
                } catch (IOException e12) {
                    e12.printStackTrace();
                }
            }
            if (outputStream != 0) {
                try {
                    outputStream.close();
                } catch (IOException e13) {
                    e13.printStackTrace();
                }
            }
            throw th7;
        }
    }

    public static String a(Context context, String str, String str2) {
        BufferedReader bufferedReader;
        HttpURLConnection httpURLConnection;
        String str3;
        HttpURLConnection httpURLConnection2;
        InputStream inputStream;
        OutputStream outputStream;
        BufferedReader bufferedReader2;
        Object obj;
        OutputStream outputStream2;
        BufferedReader bufferedReader3;
        OutputStream outputStream3;
        InputStreamReader inputStreamReader;
        HttpURLConnection httpURLConnection3;
        BufferedReader bufferedReader4;
        OutputStream outputStream4;
        InputStream inputStream2;
        InputStreamReader inputStreamReader2;
        HttpURLConnection httpURLConnection4;
        BufferedReader bufferedReader5;
        OutputStream outputStream5;
        InputStream inputStream3;
        InputStreamReader inputStreamReader3;
        HttpURLConnection httpURLConnection5;
        BufferedReader bufferedReader6;
        InputStream inputStream4;
        HttpURLConnection httpURLConnection6;
        BufferedReader bufferedReader7;
        InputStream inputStream5;
        BufferedReader bufferedReader8;
        InputStreamReader inputStreamReader4 = "&";
        try {
            try {
                try {
                    S2SBiddingConfig s2SBiddingConfig = ResponseInfo.getInstance(context).getS2SBiddingConfig();
                    String a2 = f.a("aHR0cDovL2JpZC5hZC1zY29wZS5jb20uY24vdjEvYmlkL3Mycy9w");
                    String str4 = "10001";
                    String str5 = "91acf9d2523cae5867a82b992b4296bf";
                    str3 = str4;
                    if (s2SBiddingConfig != null) {
                        if (!TextUtils.isEmpty(s2SBiddingConfig.getUrl())) {
                            a2 = s2SBiddingConfig.getUrl();
                        }
                        String str6 = str4;
                        if (!TextUtils.isEmpty(s2SBiddingConfig.getAppKey())) {
                            str6 = s2SBiddingConfig.getAppKey();
                        }
                        str3 = str6;
                        if (!TextUtils.isEmpty(s2SBiddingConfig.getSecret())) {
                            str5 = s2SBiddingConfig.getSecret();
                            str3 = str6;
                        }
                    }
                    long currentTimeMillis = System.currentTimeMillis();
                    byte[] bytes = str.getBytes();
                    httpURLConnection2 = (HttpURLConnection) new URL(a2).openConnection();
                    try {
                        httpURLConnection2.setRequestMethod(com.baidu.mobads.sdk.internal.an.b);
                        httpURLConnection2.setRequestProperty(DownloadUtils.CONTENT_LENGTH, String.valueOf(bytes.length));
                        httpURLConnection2.setRequestProperty(DownloadUtils.CONTENT_TYPE, com.baidu.mobads.sdk.internal.an.d);
                        httpURLConnection2.setConnectTimeout(BaseImageDownloader.DEFAULT_HTTP_READ_TIMEOUT);
                        httpURLConnection2.setReadTimeout(BaseImageDownloader.DEFAULT_HTTP_READ_TIMEOUT);
                        httpURLConnection2.setDoOutput(true);
                        httpURLConnection2.setDoInput(true);
                        httpURLConnection2.setRequestProperty("appKey", str3);
                        httpURLConnection2.setRequestProperty("requestid", str2);
                        httpURLConnection2.setRequestProperty("timestamp", String.valueOf(currentTimeMillis));
                        httpURLConnection2.setRequestProperty("secretKey", str5);
                        StringBuffer stringBuffer = new StringBuffer();
                        stringBuffer.append(str3);
                        stringBuffer.append("&");
                        stringBuffer.append((String) str);
                        stringBuffer.append("&");
                        stringBuffer.append((String) str2);
                        stringBuffer.append("&");
                        stringBuffer.append(currentTimeMillis);
                        stringBuffer.append("&");
                        stringBuffer.append(str5);
                        httpURLConnection2.setRequestProperty("sign", at.a(stringBuffer.toString()));
                        httpURLConnection2.connect();
                        if (bytes.length > 0) {
                            OutputStream outputStream6 = httpURLConnection2.getOutputStream();
                            try {
                                outputStream6.write(bytes);
                                outputStream3 = outputStream6;
                            } catch (Exception e) {
                                e = e;
                                outputStream2 = outputStream3;
                                obj = null;
                                bufferedReader3 = null;
                                httpURLConnection = httpURLConnection2;
                                bufferedReader = bufferedReader3;
                                inputStreamReader4 = bufferedReader3;
                                str = obj;
                                str2 = outputStream2;
                                e.printStackTrace();
                                if (str != 0) {
                                    try {
                                        str.close();
                                        if (inputStreamReader4 != 0) {
                                            inputStreamReader4.close();
                                        }
                                        if (bufferedReader != null) {
                                            bufferedReader.close();
                                        }
                                        httpURLConnection.disconnect();
                                    } catch (IOException e2) {
                                        e2.printStackTrace();
                                    }
                                }
                                if (str2 != 0) {
                                    str2.close();
                                    inputStreamReader4 = inputStreamReader4;
                                    bufferedReader = bufferedReader;
                                    httpURLConnection = httpURLConnection;
                                    str = str;
                                    str2 = str2;
                                }
                                return null;
                            } catch (Throwable th) {
                                th = th;
                                outputStream = outputStream3;
                                inputStream = null;
                                bufferedReader2 = null;
                                httpURLConnection = httpURLConnection2;
                                bufferedReader = bufferedReader2;
                                inputStreamReader4 = bufferedReader2;
                                str = inputStream;
                                str2 = outputStream;
                                th.printStackTrace();
                                if (str != null) {
                                    try {
                                        str.close();
                                        if (inputStreamReader4 != null) {
                                            inputStreamReader4.close();
                                        }
                                        if (bufferedReader != null) {
                                            bufferedReader.close();
                                        }
                                        httpURLConnection.disconnect();
                                    } catch (IOException e3) {
                                        e3.printStackTrace();
                                    }
                                }
                                if (str2 != null) {
                                    str2.close();
                                    inputStreamReader4 = inputStreamReader4;
                                    bufferedReader = bufferedReader;
                                    httpURLConnection = httpURLConnection;
                                    str = str;
                                    str2 = str2;
                                }
                                return null;
                            }
                        } else {
                            outputStream3 = null;
                        }
                        str2 = 200;
                    } catch (Exception e4) {
                        e = e4;
                        obj = null;
                        outputStream2 = null;
                        bufferedReader3 = null;
                    } catch (Throwable th2) {
                        th = th2;
                        inputStream = null;
                        outputStream = null;
                        bufferedReader2 = null;
                    }
                } catch (IOException e5) {
                    e5.printStackTrace();
                }
            } catch (Exception e6) {
                e = e6;
                str = 0;
                str2 = 0;
                inputStreamReader4 = 0;
                bufferedReader = null;
                httpURLConnection = null;
            } catch (Throwable th3) {
                th = th3;
                str = null;
                str2 = null;
                inputStreamReader4 = null;
                bufferedReader = null;
                httpURLConnection = null;
            }
            if (httpURLConnection2.getResponseCode() != 200) {
                if (outputStream3 != null) {
                    outputStream3.close();
                    inputStreamReader4 = inputStreamReader4;
                    bufferedReader = httpURLConnection2;
                    httpURLConnection = str3;
                    str = outputStream3;
                }
                return null;
            }
            InputStream inputStream6 = httpURLConnection2.getInputStream();
            try {
                inputStreamReader3 = new InputStreamReader(inputStream6);
                try {
                    bufferedReader8 = new BufferedReader(inputStreamReader3);
                } catch (Exception e7) {
                    httpURLConnection6 = httpURLConnection2;
                    bufferedReader7 = null;
                    outputStream5 = outputStream3;
                    inputStream5 = inputStream6;
                    e = e7;
                } catch (Throwable th4) {
                    httpURLConnection5 = httpURLConnection2;
                    bufferedReader6 = null;
                    outputStream4 = outputStream3;
                    inputStream4 = inputStream6;
                    th = th4;
                }
            } catch (Exception e8) {
                inputStreamReader2 = null;
                httpURLConnection4 = httpURLConnection2;
                bufferedReader5 = null;
                outputStream5 = outputStream3;
                inputStream3 = inputStream6;
                e = e8;
            } catch (Throwable th5) {
                inputStreamReader = null;
                httpURLConnection3 = httpURLConnection2;
                bufferedReader4 = null;
                outputStream4 = outputStream3;
                inputStream2 = inputStream6;
                th = th5;
            }
            try {
                StringBuffer stringBuffer2 = new StringBuffer();
                while (true) {
                    String readLine = bufferedReader8.readLine();
                    if (readLine == null) {
                        break;
                    }
                    stringBuffer2.append(readLine);
                }
                String stringBuffer3 = stringBuffer2.toString();
                if (inputStream6 != null) {
                    try {
                        inputStream6.close();
                        inputStreamReader3.close();
                        bufferedReader8.close();
                        httpURLConnection2.disconnect();
                    } catch (IOException e9) {
                        e9.printStackTrace();
                    }
                }
                if (outputStream3 != null) {
                    try {
                        outputStream3.close();
                    } catch (IOException e10) {
                        e10.printStackTrace();
                    }
                }
                return stringBuffer3;
            } catch (Exception e11) {
                outputStream5 = outputStream3;
                inputStream5 = inputStream6;
                e = e11;
                httpURLConnection6 = httpURLConnection2;
                bufferedReader7 = bufferedReader8;
                inputStreamReader2 = inputStreamReader3;
                bufferedReader5 = bufferedReader7;
                httpURLConnection4 = httpURLConnection6;
                inputStream3 = inputStream5;
                str2 = outputStream5;
                inputStreamReader4 = inputStreamReader2;
                bufferedReader = bufferedReader5;
                httpURLConnection = httpURLConnection4;
                str = inputStream3;
                e.printStackTrace();
                if (str != 0) {
                }
                if (str2 != 0) {
                }
                return null;
            } catch (Throwable th6) {
                outputStream4 = outputStream3;
                inputStream4 = inputStream6;
                th = th6;
                httpURLConnection5 = httpURLConnection2;
                bufferedReader6 = bufferedReader8;
                inputStreamReader = inputStreamReader3;
                bufferedReader4 = bufferedReader6;
                httpURLConnection3 = httpURLConnection5;
                inputStream2 = inputStream4;
                str2 = outputStream4;
                inputStreamReader4 = inputStreamReader;
                bufferedReader = bufferedReader4;
                httpURLConnection = httpURLConnection3;
                str = inputStream2;
                th.printStackTrace();
                if (str != null) {
                }
                if (str2 != null) {
                }
                return null;
            }
        } catch (Throwable th7) {
            if (str != 0) {
                try {
                    str.close();
                    if (inputStreamReader4 != 0) {
                        inputStreamReader4.close();
                    }
                    if (bufferedReader != null) {
                        bufferedReader.close();
                    }
                    httpURLConnection.disconnect();
                } catch (IOException e12) {
                    e12.printStackTrace();
                }
            }
            if (str2 != 0) {
                try {
                    str2.close();
                } catch (IOException e13) {
                    e13.printStackTrace();
                }
            }
            throw th7;
        }
    }

    public static String a(String str, File file) {
        InputStreamReader inputStreamReader;
        BufferedReader bufferedReader;
        InputStream inputStream;
        InputStream inputStream2;
        InputStreamReader inputStreamReader2;
        BufferedReader bufferedReader2;
        DataOutputStream dataOutputStream;
        InputStream inputStream3;
        InputStreamReader inputStreamReader3;
        StringBuffer stringBuffer = new StringBuffer();
        DataOutputStream dataOutputStream2 = null;
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
            httpURLConnection.setDoInput(true);
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setRequestMethod(com.baidu.mobads.sdk.internal.an.b);
            httpURLConnection.setRequestProperty("Connection", "Keep-Alive");
            httpURLConnection.setRequestProperty("Charset", Key.STRING_CHARSET_NAME);
            httpURLConnection.setRequestProperty(DownloadUtils.CONTENT_TYPE, "multipart/form-data;boundary=*****");
            dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
            try {
                dataOutputStream.writeBytes("--*****\r\n");
                dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\"" + file.getName() + "\"\r\n");
                dataOutputStream.writeBytes("\r\n");
                FileInputStream fileInputStream = new FileInputStream(file);
                byte[] bArr = new byte[1024];
                while (true) {
                    int read = fileInputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    dataOutputStream.write(bArr, 0, read);
                }
                dataOutputStream.writeBytes("\r\n");
                fileInputStream.close();
                dataOutputStream.writeBytes("--*****--\r\n");
                dataOutputStream.flush();
                if (httpURLConnection.getResponseCode() == 200) {
                    inputStream3 = httpURLConnection.getInputStream();
                    try {
                        inputStreamReader = new InputStreamReader(inputStream3);
                        try {
                            bufferedReader = new BufferedReader(inputStreamReader);
                        } catch (Exception e) {
                            bufferedReader2 = null;
                            inputStreamReader3 = inputStreamReader;
                            inputStream2 = inputStream3;
                            e = e;
                            inputStreamReader2 = inputStreamReader3;
                            try {
                                e.printStackTrace();
                                if (dataOutputStream != null) {
                                    try {
                                        dataOutputStream.close();
                                    } catch (IOException e2) {
                                        e2.printStackTrace();
                                    }
                                }
                                if (bufferedReader2 != null) {
                                    try {
                                        bufferedReader2.close();
                                    } catch (IOException e3) {
                                        e3.printStackTrace();
                                    }
                                }
                                if (inputStreamReader2 != null) {
                                    try {
                                        inputStreamReader2.close();
                                    } catch (IOException e4) {
                                        e4.printStackTrace();
                                    }
                                }
                                if (inputStream2 != null) {
                                    try {
                                        inputStream2.close();
                                    } catch (IOException e5) {
                                        e5.printStackTrace();
                                    }
                                }
                                return null;
                            } catch (Throwable th) {
                                th = th;
                                dataOutputStream2 = dataOutputStream;
                                BufferedReader bufferedReader3 = bufferedReader2;
                                inputStream = inputStream2;
                                inputStreamReader = inputStreamReader2;
                                bufferedReader = bufferedReader3;
                                if (dataOutputStream2 != null) {
                                    try {
                                        dataOutputStream2.close();
                                    } catch (IOException e6) {
                                        e6.printStackTrace();
                                    }
                                }
                                if (bufferedReader != null) {
                                    try {
                                        bufferedReader.close();
                                    } catch (IOException e7) {
                                        e7.printStackTrace();
                                    }
                                }
                                if (inputStreamReader != null) {
                                    try {
                                        inputStreamReader.close();
                                    } catch (IOException e8) {
                                        e8.printStackTrace();
                                    }
                                }
                                if (inputStream != null) {
                                    try {
                                        inputStream.close();
                                    } catch (IOException e9) {
                                        e9.printStackTrace();
                                    }
                                }
                                throw th;
                            }
                        } catch (Throwable th2) {
                            inputStream = inputStream3;
                            th = th2;
                            bufferedReader = null;
                            dataOutputStream2 = dataOutputStream;
                            if (dataOutputStream2 != null) {
                            }
                            if (bufferedReader != null) {
                            }
                            if (inputStreamReader != null) {
                            }
                            if (inputStream != null) {
                            }
                            throw th;
                        }
                    } catch (Exception e10) {
                        inputStreamReader2 = null;
                        bufferedReader2 = null;
                        inputStream2 = inputStream3;
                        e = e10;
                        e.printStackTrace();
                        if (dataOutputStream != null) {
                        }
                        if (bufferedReader2 != null) {
                        }
                        if (inputStreamReader2 != null) {
                        }
                        if (inputStream2 != null) {
                        }
                        return null;
                    } catch (Throwable th3) {
                        inputStream = inputStream3;
                        th = th3;
                        inputStreamReader = null;
                        bufferedReader = null;
                    }
                    try {
                        stringBuffer = new StringBuffer();
                        while (true) {
                            String readLine = bufferedReader.readLine();
                            if (readLine == null) {
                                break;
                            }
                            stringBuffer.append(readLine);
                            stringBuffer.append("\n");
                        }
                    } catch (Exception e11) {
                        inputStreamReader3 = inputStreamReader;
                        inputStream2 = inputStream3;
                        e = e11;
                        bufferedReader2 = bufferedReader;
                        inputStreamReader2 = inputStreamReader3;
                        e.printStackTrace();
                        if (dataOutputStream != null) {
                        }
                        if (bufferedReader2 != null) {
                        }
                        if (inputStreamReader2 != null) {
                        }
                        if (inputStream2 != null) {
                        }
                        return null;
                    } catch (Throwable th4) {
                        dataOutputStream2 = dataOutputStream;
                        inputStream = inputStream3;
                        th = th4;
                        if (dataOutputStream2 != null) {
                        }
                        if (bufferedReader != null) {
                        }
                        if (inputStreamReader != null) {
                        }
                        if (inputStream != null) {
                        }
                        throw th;
                    }
                } else {
                    inputStream3 = null;
                    inputStreamReader = null;
                    bufferedReader = null;
                }
                String stringBuffer2 = stringBuffer.toString();
                try {
                    dataOutputStream.close();
                } catch (IOException e12) {
                    e12.printStackTrace();
                }
                if (bufferedReader != null) {
                    try {
                        bufferedReader.close();
                    } catch (IOException e13) {
                        e13.printStackTrace();
                    }
                }
                if (inputStreamReader != null) {
                    try {
                        inputStreamReader.close();
                    } catch (IOException e14) {
                        e14.printStackTrace();
                    }
                }
                if (inputStream3 != null) {
                    try {
                        inputStream3.close();
                    } catch (IOException e15) {
                        e15.printStackTrace();
                    }
                }
                return stringBuffer2;
            } catch (Exception e16) {
                e = e16;
                inputStream2 = null;
                inputStreamReader2 = null;
                bufferedReader2 = null;
            } catch (Throwable th5) {
                th = th5;
                inputStreamReader = null;
                bufferedReader = null;
                inputStream = null;
            }
        } catch (Exception e17) {
            e = e17;
            inputStream2 = null;
            inputStreamReader2 = null;
            bufferedReader2 = null;
            dataOutputStream = null;
        } catch (Throwable th6) {
            th = th6;
            inputStreamReader = null;
            bufferedReader = null;
            inputStream = null;
        }
    }

    public static String a(Context context, String str, String str2, Boolean bool) {
        InputStream inputStream;
        HttpURLConnection httpURLConnection;
        OutputStream outputStream;
        InputStream inputStream2;
        HttpURLConnection httpURLConnection2;
        OutputStream outputStream2;
        ?? r2;
        OutputStream outputStream3;
        ?? r1;
        InputStreamReader inputStreamReader;
        InputStreamReader inputStreamReader2;
        InputStreamReader inputStreamReader3;
        HttpURLConnection httpURLConnection3;
        if (context != null && str != null && str2 != null) {
            byte[] b = bool.booleanValue() ? b(context, str2) : a(context, str2);
            try {
                if (b == null) {
                    return null;
                }
                try {
                    httpURLConnection2 = (HttpURLConnection) new URL(str).openConnection();
                } catch (Exception unused) {
                    inputStream2 = null;
                    httpURLConnection2 = null;
                    outputStream2 = null;
                } catch (Throwable th) {
                    th = th;
                    inputStream = null;
                    httpURLConnection = null;
                    outputStream = null;
                }
                try {
                    httpURLConnection2.setRequestMethod(com.baidu.mobads.sdk.internal.an.b);
                    httpURLConnection2.setRequestProperty(DownloadUtils.CONTENT_LENGTH, String.valueOf(b.length));
                    httpURLConnection2.setRequestProperty(DownloadUtils.CONTENT_TYPE, com.baidu.mobads.sdk.internal.an.d);
                    httpURLConnection2.setConnectTimeout(10000);
                    httpURLConnection2.setReadTimeout(5000);
                    httpURLConnection2.setDoOutput(true);
                    httpURLConnection2.setDoInput(true);
                    httpURLConnection2.connect();
                    if (b == null || b.length <= 0) {
                        outputStream2 = null;
                    } else {
                        outputStream2 = httpURLConnection2.getOutputStream();
                        try {
                            outputStream2.write(b);
                        } catch (Exception unused2) {
                            inputStream2 = null;
                            outputStream3 = null;
                            r1 = outputStream3;
                            inputStreamReader2 = outputStream3;
                            if (inputStream2 != null) {
                            }
                            if (outputStream2 != null) {
                            }
                            return null;
                        } catch (Throwable th2) {
                            th = th2;
                            outputStream = outputStream2;
                            inputStreamReader = 0;
                            r2 = null;
                            httpURLConnection = httpURLConnection2;
                            inputStream = null;
                            try {
                                th.printStackTrace();
                                if (inputStream != null) {
                                }
                                if (outputStream != null) {
                                }
                                return null;
                            } catch (Throwable th3) {
                                if (inputStream != null) {
                                    try {
                                        inputStream.close();
                                        inputStreamReader.close();
                                        r2.close();
                                        httpURLConnection.disconnect();
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                    }
                                }
                                if (outputStream != null) {
                                    try {
                                        outputStream.close();
                                    } catch (IOException e2) {
                                        e2.printStackTrace();
                                    }
                                }
                                throw th3;
                            }
                        }
                    }
                } catch (Exception unused3) {
                    inputStream2 = null;
                    outputStream2 = null;
                    outputStream3 = outputStream2;
                    r1 = outputStream3;
                    inputStreamReader2 = outputStream3;
                    if (inputStream2 != null) {
                    }
                    if (outputStream2 != null) {
                    }
                    return null;
                } catch (Throwable th4) {
                    th = th4;
                    httpURLConnection = httpURLConnection2;
                    inputStream = null;
                    outputStream = null;
                    OutputStream outputStream4 = outputStream;
                    r2 = outputStream4;
                    inputStreamReader = outputStream4;
                    th.printStackTrace();
                    if (inputStream != null) {
                    }
                    if (outputStream != null) {
                    }
                    return null;
                }
                if (httpURLConnection2.getResponseCode() == 200) {
                    inputStream2 = httpURLConnection2.getInputStream();
                    try {
                        InputStreamReader inputStreamReader4 = new InputStreamReader(inputStream2);
                        try {
                            r1 = new BufferedReader(inputStreamReader4);
                            try {
                                StringBuffer stringBuffer = new StringBuffer();
                                while (true) {
                                    String readLine = r1.readLine();
                                    if (readLine == null) {
                                        break;
                                    }
                                    stringBuffer.append(readLine);
                                }
                                String stringBuffer2 = stringBuffer.toString();
                                if (inputStream2 != null) {
                                    try {
                                        inputStream2.close();
                                        inputStreamReader4.close();
                                        r1.close();
                                        httpURLConnection2.disconnect();
                                    } catch (IOException e3) {
                                        e3.printStackTrace();
                                    }
                                }
                                if (outputStream2 != null) {
                                    try {
                                        outputStream2.close();
                                    } catch (IOException e4) {
                                        e4.printStackTrace();
                                    }
                                }
                                return stringBuffer2;
                            } catch (Exception unused4) {
                                inputStreamReader2 = inputStreamReader4;
                                if (inputStream2 != null) {
                                    try {
                                        inputStream2.close();
                                        inputStreamReader2.close();
                                        r1.close();
                                        httpURLConnection2.disconnect();
                                    } catch (IOException e5) {
                                        e5.printStackTrace();
                                    }
                                }
                                if (outputStream2 != null) {
                                    outputStream2.close();
                                }
                                return null;
                            } catch (Throwable th5) {
                                httpURLConnection3 = httpURLConnection2;
                                inputStream = inputStream2;
                                th = th5;
                                r2 = r1;
                                inputStreamReader3 = inputStreamReader4;
                                outputStream = outputStream2;
                                httpURLConnection = httpURLConnection3;
                                inputStreamReader = inputStreamReader3;
                                th.printStackTrace();
                                if (inputStream != null) {
                                    try {
                                        inputStream.close();
                                        inputStreamReader.close();
                                        r2.close();
                                        httpURLConnection.disconnect();
                                    } catch (IOException e6) {
                                        e6.printStackTrace();
                                    }
                                }
                                if (outputStream != null) {
                                    outputStream.close();
                                }
                                return null;
                            }
                        } catch (Exception unused5) {
                            r1 = null;
                            inputStreamReader2 = inputStreamReader4;
                        } catch (Throwable th6) {
                            r2 = null;
                            httpURLConnection3 = httpURLConnection2;
                            inputStream = inputStream2;
                            th = th6;
                        }
                    } catch (Exception unused6) {
                        outputStream3 = null;
                        r1 = outputStream3;
                        inputStreamReader2 = outputStream3;
                        if (inputStream2 != null) {
                        }
                        if (outputStream2 != null) {
                        }
                        return null;
                    } catch (Throwable th7) {
                        inputStreamReader3 = null;
                        r2 = null;
                        httpURLConnection3 = httpURLConnection2;
                        inputStream = inputStream2;
                        th = th7;
                    }
                } else if (outputStream2 != null) {
                    outputStream2.close();
                }
            } catch (IOException e7) {
                e7.printStackTrace();
            }
        }
        return null;
    }

    private static byte[] a(Context context, String str) {
        try {
            RequestInfo requestInfo = RequestInfo.getInstance(context);
            if (!requestInfo.isInit) {
                requestInfo.init();
            }
            DevInfo devInfo = requestInfo.getDevInfo();
            EnvInfo envInfo = requestInfo.getEnvInfo();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("appId", str);
            jSONObject.put("packageName", au.c(context));
            jSONObject.put("installTime", String.valueOf(au.a(context)));
            jSONObject.put("updateTime", String.valueOf(au.b(context)));
            jSONObject.put("uploadTime", String.valueOf(System.currentTimeMillis()));
            jSONObject.put("appVersion", au.d(context));
            jSONObject.put("sdkVersion", "4.90.3.1");
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("sdkUID", devInfo.getSdkUID());
            jSONObject2.put("sdkUIDOrig", devInfo.getSdkUIDOrig());
            if (!TextUtils.isEmpty(devInfo.getOaid())) {
                jSONObject2.put("oaid", devInfo.getOaid());
            } else if (!TextUtils.isEmpty(requestInfo.getCustomOaid())) {
                jSONObject2.put("oaid", requestInfo.getCustomOaid());
            }
            jSONObject2.put("gaid", devInfo.getGaid());
            jSONObject2.put("os", devInfo.getOs());
            jSONObject2.put("platform", "2");
            jSONObject2.put("devType", devInfo.getDevType());
            jSONObject2.put(bk.j, devInfo.getBrand());
            jSONObject2.put(bk.i, devInfo.getModel());
            jSONObject2.put("resolution", devInfo.getResolution());
            jSONObject2.put("screenSize", devInfo.getScreenSize());
            jSONObject2.put("language", devInfo.getLanguage());
            jSONObject2.put("density", devInfo.getDensity());
            jSONObject2.put("root", devInfo.getRoot());
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put(TKDownloadReason.KSAD_TK_NET, envInfo.getNet());
            jSONObject3.put("isp", envInfo.getIsp());
            jSONObject3.put("developerMode", au.h(context));
            jSONObject3.put("isDebugApk", au.g(context));
            jSONObject3.put("isDebugConnected", Debug.isDebuggerConnected());
            jSONObject3.put("isWifiProxy", au.i(context));
            jSONObject3.put("isVpn", au.b());
            jSONObject3.put("isSimulator", v.a().a(context));
            jSONObject.putOpt("devInfo", jSONObject2);
            jSONObject.putOpt("envInfo", jSONObject3);
            String a2 = c.a(jSONObject.toString(), ac.b());
            if (TextUtils.isEmpty(a2)) {
                return null;
            }
            return a2.getBytes();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    private static byte[] b(Context context, String str) {
        try {
            RequestInfo requestInfo = RequestInfo.getInstance(context);
            if (!requestInfo.isInit) {
                requestInfo.init();
            }
            DevInfo devInfo = requestInfo.getDevInfo();
            EnvInfo envInfo = requestInfo.getEnvInfo();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("version", "4.90.3.1");
            jSONObject.put("srcType", 1);
            jSONObject.put("timeStamp", System.currentTimeMillis());
            jSONObject.put("appid", str);
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("sdkUID", devInfo.getSdkUID());
            jSONObject2.put("sdkUIDOrig", devInfo.getSdkUIDOrig());
            jSONObject2.put("os", devInfo.getOs());
            jSONObject2.put("platform", 2);
            jSONObject2.put("devType", Integer.valueOf(devInfo.getDevType()));
            jSONObject2.put(bk.j, devInfo.getBrand());
            jSONObject2.put(bk.i, devInfo.getModel());
            jSONObject2.put("resolution", devInfo.getResolution());
            jSONObject2.put("screenSize", devInfo.getScreenSize());
            jSONObject2.put("language", devInfo.getLanguage());
            jSONObject2.put("density", devInfo.getDensity());
            jSONObject2.put("root", devInfo.getRoot());
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put(TKDownloadReason.KSAD_TK_NET, Integer.valueOf(envInfo.getNet()));
            jSONObject3.put("isp", Integer.valueOf(envInfo.getIsp()));
            jSONObject.putOpt("devInfo", jSONObject2);
            jSONObject.putOpt("envInfo", jSONObject3);
            String a2 = d.a(ac.a(), jSONObject.toString());
            if (TextUtils.isEmpty(a2)) {
                return null;
            }
            return a2.getBytes();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    public static String a(Context context, String str, String str2, boolean z, List<String> list, List<b.k> list2, int i) {
        try {
            RequestInfo requestInfo = RequestInfo.getInstance(context);
            if (!requestInfo.isInit) {
                requestInfo.init();
            }
            DevInfo devInfo = requestInfo.getDevInfo();
            EnvInfo envInfo = requestInfo.getEnvInfo();
            com.beizi.fusion.d.a.b bVar = new com.beizi.fusion.d.a.b();
            b.i iVar = new b.i();
            iVar.a(str);
            iVar.a(0);
            iVar.b(i);
            iVar.c(1);
            ArrayList arrayList = new ArrayList();
            arrayList.add(WindAds.CNY);
            iVar.a(arrayList);
            iVar.b(list);
            iVar.d(1);
            ArrayList arrayList2 = new ArrayList();
            b.f fVar = new b.f();
            fVar.a("1");
            fVar.a(1);
            fVar.b(1);
            fVar.c(1);
            b.g gVar = new b.g();
            b.h hVar = new b.h();
            hVar.a(str2);
            hVar.b("AdScope");
            hVar.c("4.90.3.1");
            hVar.a(z ? 1 : 0);
            gVar.a(hVar);
            fVar.a(gVar);
            fVar.d(1);
            arrayList2.add(fVar);
            iVar.c(arrayList2);
            b.c cVar = new b.c();
            b.a aVar = new b.a();
            aVar.a(au.c(context));
            aVar.b(au.d(context));
            b.C0034b c0034b = new b.C0034b();
            c0034b.a(com.beizi.fusion.d.b.a().b());
            aVar.a(c0034b);
            cVar.a(aVar);
            b.d dVar = new b.d();
            dVar.a(Integer.valueOf(devInfo.getDevType()).intValue());
            dVar.a(envInfo.getUserAgent());
            dVar.b(1);
            dVar.a(envInfo.getUserAgent());
            dVar.b(devInfo.getBrand());
            dVar.c(devInfo.getModel());
            dVar.c(2);
            dVar.d(Build.VERSION.RELEASE);
            dVar.a(au.m(context));
            dVar.b(au.l(context));
            dVar.e(devInfo.getDensityDpi());
            dVar.f(devInfo.getDensity());
            dVar.g(devInfo.getLanguage());
            dVar.h(envInfo.getIsp());
            dVar.i(envInfo.getNet());
            b.e eVar = new b.e();
            eVar.a(devInfo.getSdkUID());
            if (!TextUtils.isEmpty(devInfo.getOaid())) {
                eVar.b(devInfo.getOaid());
            } else if (!TextUtils.isEmpty(requestInfo.getCustomOaid())) {
                eVar.b(requestInfo.getCustomOaid());
            }
            dVar.a(eVar);
            cVar.a(dVar);
            iVar.a(cVar);
            b.j jVar = new b.j();
            jVar.a(list2);
            iVar.a(jVar);
            bVar.a(iVar);
            String a2 = d.a(ac.a(), JsonResolver.toJson(bVar));
            if (TextUtils.isEmpty(a2)) {
                return null;
            }
            return a2;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }
}