导航菜单

页面标题

页面副标题

Dostt v1.0.89 - SpotlightIntegration.java 源代码

正在查看: Dostt v1.0.89 应用的 SpotlightIntegration.java JAVA 源代码文件

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


package io.sentry;

import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import io.sentry.C1593t2;
import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URLConnection;
import java.util.concurrent.RejectedExecutionException;
import java.util.zip.GZIPOutputStream;

public final class SpotlightIntegration implements InterfaceC1532f0, C1593t2.c, Closeable {
    private C1593t2 a;
    private ILogger b = A0.e();
    private Y c = F0.e();

    private void g(HttpURLConnection httpURLConnection) {
        try {
            httpURLConnection.getInputStream().close();
        } catch (IOException unused) {
        } catch (Throwable th2) {
            httpURLConnection.disconnect();
            throw th2;
        }
        httpURLConnection.disconnect();
    }

    private HttpURLConnection j(String str) {
        HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(URI.create(str).toURL().openConnection()));
        httpURLConnection.setReadTimeout(1000);
        httpURLConnection.setConnectTimeout(1000);
        httpURLConnection.setRequestMethod("POST");
        httpURLConnection.setDoOutput(true);
        httpURLConnection.setRequestProperty("Content-Encoding", "gzip");
        httpURLConnection.setRequestProperty("Content-Type", "application/x-sentry-envelope");
        httpURLConnection.setRequestProperty("Accept", "application/json");
        httpURLConnection.setRequestProperty("Connection", "close");
        httpURLConnection.connect();
        return httpURLConnection;
    }

    public void l(B1 b1) {
        try {
            if (this.a == null) {
                throw new IllegalArgumentException("SentryOptions are required to send envelopes.");
            }
            HttpURLConnection j = j(k());
            try {
                OutputStream outputStream = j.getOutputStream();
                try {
                    GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
                    try {
                        this.a.getSerializer().b(b1, gZIPOutputStream);
                        gZIPOutputStream.close();
                        if (outputStream != null) {
                            outputStream.close();
                        }
                        this.b.c(EnumC1554k2.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(j.getResponseCode()));
                    } finally {
                    }
                } finally {
                }
            } catch (Throwable th2) {
                try {
                    this.b.b(EnumC1554k2.ERROR, "An exception occurred while submitting the envelope to the Sentry server.", th2);
                    this.b.c(EnumC1554k2.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(j.getResponseCode()));
                } catch (Throwable th3) {
                    this.b.c(EnumC1554k2.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(j.getResponseCode()));
                    g(j);
                    throw th3;
                }
            }
            g(j);
        } catch (Exception e) {
            this.b.b(EnumC1554k2.ERROR, "An exception occurred while creating the connection to spotlight.", e);
        }
    }

    @Override
    public void a(final B1 b1, C c) {
        try {
            this.c.submit(new Runnable() {
                @Override
                public final void run() {
                    SpotlightIntegration.this.l(b1);
                }
            });
        } catch (RejectedExecutionException e) {
            this.b.b(EnumC1554k2.WARNING, "Spotlight envelope submission rejected.", e);
        }
    }

    @Override
    public void close() {
        this.c.a(0L);
        C1593t2 c1593t2 = this.a;
        if (c1593t2 == null || c1593t2.getBeforeEnvelopeCallback() != this) {
            return;
        }
        this.a.setBeforeEnvelopeCallback(null);
    }

    @Override
    public void e(O o, C1593t2 c1593t2) {
        this.a = c1593t2;
        this.b = c1593t2.getLogger();
        if (c1593t2.getBeforeEnvelopeCallback() != null || !c1593t2.isEnableSpotlight()) {
            this.b.c(EnumC1554k2.DEBUG, "SpotlightIntegration is not enabled. BeforeEnvelopeCallback is already set or spotlight is not enabled.", new Object[0]);
            return;
        }
        this.c = new C1522c2();
        c1593t2.setBeforeEnvelopeCallback(this);
        this.b.c(EnumC1554k2.DEBUG, "SpotlightIntegration enabled.", new Object[0]);
    }

    public String k() {
        C1593t2 c1593t2 = this.a;
        return (c1593t2 == null || c1593t2.getSpotlightConnectionUrl() == null) ? io.sentry.util.s.a() ? "http://10.0.2.2:8969/stream" : "http://localhost:8969/stream" : this.a.getSpotlightConnectionUrl();
    }
}