atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9

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


package com.appodeal.ads.services.crash_hunter.internal;

import com.appodeal.ads.Appodeal;
import com.appodeal.ads.services.crash_hunter.ApdCrashHunterLogger;
import com.yandex.metrica.YandexMetricaDefaultValues;
import java.io.DataOutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
final class ExceptionTask implements Runnable {
    private final ExceptionStore exceptionStore;

    public ExceptionTask(ExceptionStore exceptionStore) {
        this.exceptionStore = exceptionStore;
    }

    @Override
    public void run() {
        HttpURLConnection httpURLConnection;
        try {
            List<String> exceptions = this.exceptionStore.exceptions(false);
            JSONArray jSONArray = new JSONArray();
            for (String str : exceptions) {
                jSONArray.put(new JSONObject(str));
            }
            HttpURLConnection httpURLConnection2 = null;
            try {
                httpURLConnection = (HttpURLConnection) getUrl().openConnection();
            } catch (Throwable th) {
                th = th;
            }
            try {
                httpURLConnection.setConnectTimeout(YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND);
                httpURLConnection.setReadTimeout(YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND);
                httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
                httpURLConnection.setDoOutput(true);
                httpURLConnection.setRequestMethod("POST");
                DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
                dataOutputStream.write(jSONArray.toString().getBytes(Charset.forName("UTF-8")));
                dataOutputStream.flush();
                dataOutputStream.close();
                int responseCode = httpURLConnection.getResponseCode();
                ApdCrashHunterLogger.log("ExceptionTask", "finished", "responseCode: " + responseCode);
                if (responseCode == 200) {
                    this.exceptionStore.removeExceptions(exceptions);
                } else if (responseCode == 503) {
                    this.exceptionStore.setRetryAfter(httpURLConnection.getHeaderField("Retry-After"));
                }
                if (httpURLConnection != null) {
                    httpURLConnection.getInputStream().close();
                    httpURLConnection.disconnect();
                }
            } catch (Throwable th2) {
                th = th2;
                httpURLConnection2 = httpURLConnection;
                ApdCrashHunterLogger.log(th);
                if (httpURLConnection2 != null) {
                    httpURLConnection2.getInputStream().close();
                    httpURLConnection2.disconnect();
                }
            }
        } catch (Throwable th3) {
            ApdCrashHunterLogger.log(th3);
        }
    }

    URL getUrl() throws MalformedURLException {
        return new URL("https://mds-api.appodeal.com/v2/crash/android/" + Appodeal.getVersion());
    }
}