导航菜单

页面标题

页面副标题

BAM Crawford v6.14.1 - SpotlightIntegration.java 源代码

正在查看: BAM Crawford v6.14.1 应用的 SpotlightIntegration.java JAVA 源代码文件

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


package io.sentry;

import com.subsplash.thechurchapp.dataObjects.Constants;
import io.sentry.s5;
import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.util.concurrent.RejectedExecutionException;
import java.util.zip.GZIPOutputStream;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public final class SpotlightIntegration implements e1, s5.c, Closeable {
    private s5 p;
    private ILogger q = z1.e();
    private x0 r = e2.e();

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

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

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

    @Override
    public void c(final a4 a4Var, c0 c0Var) {
        try {
            this.r.submit(new Runnable() {
                @Override
                public final void run() {
                    SpotlightIntegration.this.t(a4Var);
                }
            });
        } catch (RejectedExecutionException e) {
            this.q.b(j5.WARNING, "Spotlight envelope submission rejected.", e);
        }
    }

    @Override
    public void close() {
        this.r.a(0L);
        s5 s5Var = this.p;
        if (s5Var == null || s5Var.getBeforeEnvelopeCallback() != this) {
            return;
        }
        this.p.setBeforeEnvelopeCallback(null);
    }

    @Override
    public void o(o0 o0Var, s5 s5Var) {
        this.p = s5Var;
        this.q = s5Var.getLogger();
        if (s5Var.getBeforeEnvelopeCallback() != null || !s5Var.isEnableSpotlight()) {
            this.q.c(j5.DEBUG, "SpotlightIntegration is not enabled. BeforeEnvelopeCallback is already set or spotlight is not enabled.", new Object[0]);
            return;
        }
        this.r = new b5();
        s5Var.setBeforeEnvelopeCallback(this);
        this.q.c(j5.DEBUG, "SpotlightIntegration enabled.", new Object[0]);
    }

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