PhotoRoom v4.8.2版本的 MD5 值为:c40a01bb3380c0f75c0cb6ac6760f295

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


package m8;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.json.JSONObject;
public final class j {
    private final h8.b f58452a;

    public static final class a extends c {
        final HttpURLConnection f58454k;
        final OutputStream f58455l;

        a(HttpURLConnection httpURLConnection, OutputStream outputStream) {
            super(httpURLConnection, null, outputStream);
            this.f58454k = httpURLConnection;
            this.f58455l = outputStream;
        }

        @Override
        public void close() {
            InputStream inputStream;
            InputStream inputStream2;
            try {
                h(j.this.b());
                j(j.this.c());
                m(j.this.g());
                i();
                OutputStream e11 = e();
                if (e11 != null) {
                    e11.close();
                }
                int responseCode = this.f58454k.getResponseCode();
                InputStream inputStream3 = null;
                try {
                    try {
                        inputStream = j.this.f(b());
                        try {
                            InputStreamReader inputStreamReader = new InputStreamReader(inputStream, kotlin.text.d.f56128b);
                            BufferedReader bufferedReader = inputStreamReader instanceof BufferedReader ? (BufferedReader) inputStreamReader : new BufferedReader(inputStreamReader, 8192);
                            try {
                                String f11 = cy.s.f(bufferedReader);
                                cy.c.a(bufferedReader, null);
                                n(k.f58456a.a(responseCode, new JSONObject(f11)));
                            } catch (Throwable th2) {
                                try {
                                    throw th2;
                                } catch (Throwable th3) {
                                    cy.c.a(bufferedReader, th2);
                                    throw th3;
                                }
                            }
                        } catch (IOException unused) {
                            n(k.f58456a.a(408, null));
                        }
                    } catch (Throwable th4) {
                        th = th4;
                        inputStream3 = inputStream2;
                        if (inputStream3 != null) {
                            inputStream3.close();
                        }
                        throw th;
                    }
                } catch (IOException unused2) {
                    inputStream = null;
                } catch (Throwable th5) {
                    th = th5;
                    if (inputStream3 != null) {
                    }
                    throw th;
                }
            } finally {
                super.close();
                OutputStream e12 = e();
                if (e12 != null) {
                    e12.close();
                }
            }
        }
    }

    public j(h8.b configuration) {
        kotlin.jvm.internal.t.i(configuration, "configuration");
        this.f58452a = configuration;
    }

    private final String a() {
        String p11 = this.f58452a.p();
        if (p11 == null || p11.length() == 0) {
            return this.f58452a.q() == h8.d.EU ? this.f58452a.s() ? "https://api.eu.amplitude.com/batch" : "https://api.eu.amplitude.com/2/httpapi" : this.f58452a.s() ? "https://api2.amplitude.com/batch" : "https://api2.amplitude.com/2/httpapi";
        }
        String p12 = this.f58452a.p();
        kotlin.jvm.internal.t.f(p12);
        return p12;
    }

    private final HttpURLConnection d(String str) {
        try {
            URLConnection openConnection = new URL(str).openConnection();
            if (openConnection != null) {
                HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
                httpURLConnection.setRequestMethod("POST");
                httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
                httpURLConnection.setRequestProperty("Accept", "application/json");
                httpURLConnection.setDoOutput(true);
                httpURLConnection.setDoInput(true);
                httpURLConnection.setConnectTimeout(15000);
                httpURLConnection.setReadTimeout(201000);
                return httpURLConnection;
            }
            throw new NullPointerException("null cannot be cast to non-null type java.net.HttpURLConnection");
        } catch (MalformedURLException e11) {
            throw new IOException(kotlin.jvm.internal.t.r("Attempted to use malformed url: ", str), e11);
        }
    }

    public final String b() {
        return this.f58452a.a();
    }

    public final String c() {
        long e11 = e();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        String format = simpleDateFormat.format(new Date(e11));
        kotlin.jvm.internal.t.h(format, "sdf.format(Date(currentTimeMillis))");
        return format;
    }

    public final long e() {
        return System.currentTimeMillis();
    }

    public final InputStream f(HttpURLConnection connection) {
        kotlin.jvm.internal.t.i(connection, "connection");
        try {
            InputStream inputStream = connection.getInputStream();
            kotlin.jvm.internal.t.h(inputStream, "{\n            connection.inputStream\n        }");
            return inputStream;
        } catch (IOException unused) {
            InputStream errorStream = connection.getErrorStream();
            kotlin.jvm.internal.t.h(errorStream, "{\n            connection.errorStream\n        }");
            return errorStream;
        }
    }

    public final Integer g() {
        return this.f58452a.l();
    }

    public final c h() {
        HttpURLConnection d11 = d(a());
        OutputStream outputStream = d11.getOutputStream();
        kotlin.jvm.internal.t.h(outputStream, "connection.outputStream");
        return new a(d11, outputStream);
    }
}