正在查看: Housing v14.7.8 应用的 SpotlightIntegration.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Housing v14.7.8 应用的 SpotlightIntegration.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package io.sentry;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.URLConnectionInstrumentation;
import io.sentry.h4;
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;
import org.jetbrains.annotations.ApiStatus$Internal;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ApiStatus$Internal
@Instrumented
public final class SpotlightIntegration implements a1, h4.c, Closeable {
@Nullable
private h4 options;
@NotNull
private k0 logger = u1.e();
@NotNull
private t0 executorService = x1.c();
public static void c(SpotlightIntegration spotlightIntegration, n3 n3Var) {
OutputStream outputStream;
spotlightIntegration.getClass();
try {
h4 h4Var = spotlightIntegration.options;
if (h4Var == null) {
throw new IllegalArgumentException("SentryOptions are required to send envelopes.");
}
HttpURLConnection i = i(h4Var.getSpotlightConnectionUrl() != null ? spotlightIntegration.options.getSpotlightConnectionUrl() : io.sentry.util.m.a() ? "http://10.0.2.2:8969/stream" : "http://localhost:8969/stream");
try {
outputStream = i.getOutputStream();
} catch (Throwable th) {
try {
spotlightIntegration.logger.b(c4.ERROR, "An exception occurred while submitting the envelope to the Sentry server.", th);
spotlightIntegration.logger.c(c4.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(i.getResponseCode()));
} catch (Throwable th2) {
spotlightIntegration.logger.c(c4.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(i.getResponseCode()));
e(i);
throw th2;
}
}
try {
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
try {
spotlightIntegration.options.getSerializer().c(n3Var, gZIPOutputStream);
gZIPOutputStream.close();
if (outputStream != null) {
outputStream.close();
}
spotlightIntegration.logger.c(c4.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(i.getResponseCode()));
e(i);
} finally {
}
} finally {
}
} catch (Exception e) {
spotlightIntegration.logger.b(c4.ERROR, "An exception occurred while creating the connection to spotlight.", e);
}
}
public static void e(HttpURLConnection httpURLConnection) {
try {
httpURLConnection.getInputStream().close();
} catch (IOException unused) {
} finally {
httpURLConnection.disconnect();
}
}
public static HttpURLConnection i(String str) {
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(URLConnectionInstrumentation.openConnection(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;
}
@Override
public final void b(f0 f0Var, h4 h4Var) {
this.options = h4Var;
this.logger = h4Var.getLogger();
if (h4Var.getBeforeEnvelopeCallback() != null || !h4Var.isEnableSpotlight()) {
this.logger.c(c4.DEBUG, "SpotlightIntegration is not enabled. BeforeEnvelopeCallback is already set or spotlight is not enabled.", new Object[0]);
return;
}
this.executorService = new x3();
h4Var.setBeforeEnvelopeCallback(this);
this.logger.c(c4.DEBUG, "SpotlightIntegration enabled.", new Object[0]);
}
@Override
public final void close() {
this.executorService.b(0L);
h4 h4Var = this.options;
if (h4Var == null || h4Var.getBeforeEnvelopeCallback() != this) {
return;
}
this.options.setBeforeEnvelopeCallback(null);
}
public final void j(n3 n3Var) {
try {
this.executorService.submit(new l(3, this, n3Var));
} catch (RejectedExecutionException e) {
this.logger.b(c4.WARNING, "Spotlight envelope submission rejected.", e);
}
}
}