导航菜单

页面标题

页面副标题

Mint v5.7.3 - c.java 源代码

正在查看: Mint v5.7.3 应用的 c.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package nb;

import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
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.net.URLConnection;
import java.nio.charset.Charset;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
import kotlin.Metadata;
import kotlin.jvm.internal.m;
import lb.Request;
import nb.d;
import org.json.JSONObject;
import ug.a0;
import yb.o;

@Metadata(d1 = {"\u0000`\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0007\b\u0000\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b%\u0010&J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0002J,\u0010\r\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0012\u0010\f\u001a\u000e\u0012\u0004\u0012\u00020\u000b\u0012\u0004\u0012\u00020\u000b0\nH\u0002J*\u0010\u0012\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\b\u0010\u000f\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0002J\u0018\u0010\u0014\u001a\u00020\u00132\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u0002H\u0002J\u0010\u0010\u0017\u001a\u00020\u000b2\u0006\u0010\u0016\u001a\u00020\u0015H\u0002J \u0010\u0018\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00152\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\t\u001a\u00020\bH\u0002J\u0010\u0010\u001b\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\u0019H\u0002J\u0010\u0010\u001d\u001a\u00020\u001c2\u0006\u0010\t\u001a\u00020\bH\u0016R\u0014\u0010\u001f\u001a\u00020\u000b8\u0002X\u0082D¢\u0006\u0006\n\u0004\b\u001d\u0010\u001eR\u0016\u0010\"\u001a\u00020 8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0012\u0010!R\u0016\u0010#\u001a\u00020 8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0007\u0010!R\u0016\u0010$\u001a\u00020 8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\r\u0010!¨\u0006'"}, d2 = {"Lnb/c;", "Lnb/h;", "Ljava/net/HttpURLConnection;", "urlConnection", BuildConfig.FLAVOR, "timeOut", "Lug/a0;", "c", "Lnb/d;", "chain", BuildConfig.FLAVOR, BuildConfig.FLAVOR, "headers", "d", "Lorg/json/JSONObject;", "requestBody", BuildConfig.FLAVOR, "isGzipEnabled", "b", "Llb/c;", "h", "Ljava/io/InputStream;", "inputStream", "f", "g", BuildConfig.FLAVOR, "input", Parameters.EVENT, "Llb/b;", "a", "Ljava/lang/String;", "tag", BuildConfig.FLAVOR, "J", "connectStartTime", "connectEndTime", "streamReadCompletionTime", "<init>", "()V", "core_release"}, k = 1, mv = {1, 7, 1})
public final class c implements h {

    private final String tag = "Core_RestClient_CallServerInterceptor";

    private long connectStartTime = -1;

    private long connectEndTime = -1;

    private long streamReadCompletionTime = -1;

    private final void b(d dVar, HttpURLConnection httpURLConnection, JSONObject jSONObject, boolean z) throws IOException {
        httpURLConnection.setDoOutput(true);
        httpURLConnection.setRequestProperty("Accept-Charset", "UTF-8");
        httpURLConnection.setRequestProperty("Content-type", "application/json");
        OutputStream outputStream = httpURLConnection.getOutputStream();
        if (jSONObject != null) {
            dVar.e(this.tag, "addBody(): Request Body: \n " + yb.e.a(jSONObject));
            String jSONObject2 = jSONObject.toString();
            m.f(jSONObject2, "requestBody.toString()");
            Charset forName = Charset.forName("UTF-8");
            m.f(forName, "forName(charsetName)");
            byte[] bytes = jSONObject2.getBytes(forName);
            m.f(bytes, "this as java.lang.String).getBytes(charset)");
            if (z) {
                dVar.e(this.tag, "addBody(): Request Body: Encoding Request Body With Gzip");
                bytes = e(bytes);
            }
            outputStream.write(bytes);
        }
        outputStream.close();
    }

    private final void c(HttpURLConnection httpURLConnection, int i) {
        int i2 = i * 1000;
        httpURLConnection.setConnectTimeout(i2);
        httpURLConnection.setReadTimeout(i2);
    }

    private final void d(d dVar, HttpURLConnection httpURLConnection, Map<String, String> map) {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            dVar.e(this.tag, "addHeaders() " + key + " : " + value);
            httpURLConnection.addRequestProperty(key, value);
        }
    }

    private final byte[] e(byte[] input) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream;
        GZIPOutputStream gZIPOutputStream;
        GZIPOutputStream gZIPOutputStream2 = null;
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
            gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
        } catch (Throwable th) {
            th = th;
        }
        try {
            gZIPOutputStream.write(input);
            gZIPOutputStream.flush();
            gZIPOutputStream.close();
            byte[] byteArray = byteArrayOutputStream.toByteArray();
            m.f(byteArray, "{\n            val byteAr…S.toByteArray()\n        }");
            return byteArray;
        } catch (Throwable th2) {
            th = th2;
            gZIPOutputStream2 = gZIPOutputStream;
            try {
                throw new IOException(th);
            } catch (Throwable th3) {
                if (gZIPOutputStream2 != null) {
                    try {
                        gZIPOutputStream2.close();
                    } catch (Throwable unused) {
                    }
                }
                throw th3;
            }
        }
    }

    private final String f(InputStream inputStream) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        StringBuilder sb2 = new StringBuilder();
        while (true) {
            try {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    a0 a0Var = a0.a;
                    dh.b.a(inputStream, (Throwable) null);
                    String sb3 = sb2.toString();
                    m.f(sb3, "stringBuilder.toString()");
                    return sb3;
                }
                sb2.append(readLine);
            } finally {
            }
        }
    }

    private final InputStream g(InputStream inputStream, HttpURLConnection urlConnection, d chain) {
        if (!oh.m.t(urlConnection.getContentEncoding(), "gzip", true)) {
            return inputStream;
        }
        chain.e(this.tag, "getInputStream(): Decoding Request Body With Gzip");
        return new GZIPInputStream(inputStream);
    }

    private final lb.c h(d chain, HttpURLConnection urlConnection) throws Exception, ma.a {
        String f;
        int responseCode = urlConnection.getResponseCode();
        boolean z = responseCode == 200;
        if (z) {
            InputStream inputStream = urlConnection.getInputStream();
            m.f(inputStream, "urlConnection.inputStream");
            f = f(g(inputStream, urlConnection, chain));
            chain.e(this.tag, "getResponse(): Code: " + responseCode + " body: \n " + yb.c.o(f));
        } else {
            InputStream errorStream = urlConnection.getErrorStream();
            m.f(errorStream, "urlConnection.errorStream");
            f = f(g(errorStream, urlConnection, chain));
            d.a.a(chain, this.tag, "getResponse(): Code: " + responseCode + " body: \n " + yb.c.o(f), null, 4, null);
        }
        this.streamReadCompletionTime = o.b();
        chain.e(this.tag, "getResponse(): Connection Response stream read complete: " + o.b() + ")}");
        return z ? new lb.h(f) : new lb.g(responseCode, f);
    }

    @Override
    public lb.b a(d chain) {
        lb.b bVar;
        String str;
        StringBuilder sb2;
        HttpURLConnection httpURLConnection;
        m.g(chain, "chain");
        chain.e(this.tag, "intercept(): Will try server call ");
        HttpURLConnection httpURLConnection2 = null;
        try {
            Request request = chain.getInterceptorRequest().getRequest();
            String uri = request.getUri().toString();
            m.f(uri, "request.uri.toString()");
            URL url = new URL(uri);
            chain.e(this.tag, "intercept(): Request url: " + uri);
            this.connectStartTime = o.b();
            chain.e(this.tag, "intercept(): Connection opened: " + this.connectStartTime);
            if (m.b("https", request.getUri().getScheme())) {
                URLConnection uRLConnection = (URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection());
                m.e(uRLConnection, "null cannot be cast to non-null type javax.net.ssl.HttpsURLConnection");
                httpURLConnection = (HttpsURLConnection) uRLConnection;
            } else {
                URLConnection uRLConnection2 = (URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection());
                m.e(uRLConnection2, "null cannot be cast to non-null type java.net.HttpURLConnection");
                httpURLConnection = (HttpURLConnection) uRLConnection2;
            }
            httpURLConnection2 = httpURLConnection;
            d(chain, httpURLConnection2, request.b());
            if (!chain.getSdkInstance().getInitConfig().getNetworkRequestConfig().getShouldCacheConnection() && request.getShouldCloseConnectionAfterRequest()) {
                chain.e(this.tag, "setting connection close header");
                httpURLConnection2.setRequestProperty("Connection", "close");
            }
            httpURLConnection2.setRequestProperty("Content-type", request.getContentType());
            httpURLConnection2.setRequestMethod(request.getRequestType().toString());
            c(httpURLConnection2, request.getTimeOut());
            boolean b = m.b(request.b().get("Content-Encoding"), "gzip");
            JSONObject requestBody = request.getRequestBody();
            if (requestBody != null && requestBody.length() > 0) {
                b(chain, httpURLConnection2, requestBody, b);
            }
            bVar = chain.c(new lb.a(request, h(chain, httpURLConnection2)));
            httpURLConnection2.disconnect();
            this.connectEndTime = o.b();
            chain.e(this.tag, "intercept(): Connection disconnected: " + this.connectEndTime + " milliseconds");
            chain.e(this.tag, "intercept(): Connect to disconnect time: " + (this.connectEndTime - this.connectStartTime) + " milliseconds");
            str = this.tag;
            sb2 = new StringBuilder();
        } catch (Throwable th) {
            try {
                chain.a(this.tag, "intercept(): ", th);
                bVar = new lb.b(new lb.g(-100, BuildConfig.FLAVOR));
                if (httpURLConnection2 != null) {
                    httpURLConnection2.disconnect();
                }
                this.connectEndTime = o.b();
                chain.e(this.tag, "intercept(): Connection disconnected: " + this.connectEndTime + " milliseconds");
                chain.e(this.tag, "intercept(): Connect to disconnect time: " + (this.connectEndTime - this.connectStartTime) + " milliseconds");
                str = this.tag;
                sb2 = new StringBuilder();
            } catch (Throwable th2) {
                if (httpURLConnection2 != null) {
                    httpURLConnection2.disconnect();
                }
                this.connectEndTime = o.b();
                chain.e(this.tag, "intercept(): Connection disconnected: " + this.connectEndTime + " milliseconds");
                chain.e(this.tag, "intercept(): Connect to disconnect time: " + (this.connectEndTime - this.connectStartTime) + " milliseconds");
                String str2 = this.tag;
                StringBuilder sb3 = new StringBuilder();
                sb3.append("intercept(): Connection Stream read to disconnected time: ");
                long j = this.connectEndTime;
                sb3.append(j - j);
                sb3.append(" milliseconds");
                chain.e(str2, sb3.toString());
                throw th2;
            }
        }
        sb2.append("intercept(): Connection Stream read to disconnected time: ");
        long j2 = this.connectEndTime;
        sb2.append(j2 - j2);
        sb2.append(" milliseconds");
        chain.e(str, sb2.toString());
        return bVar;
    }
}