正在查看: Empower MX v1.29.4.340 应用的 SpotlightIntegration.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Empower MX v1.29.4.340 应用的 SpotlightIntegration.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package io.sentry;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import f0.Bz.vMPrSZAj;
import io.sentry.L2;
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 InterfaceC1772n0, L2.b, Closeable {
private L2 d;
private T e = H0.e();
private InterfaceC1732d0 i = Q0.f();
public void v(Y1 y1) {
try {
if (this.d == null) {
throw new IllegalArgumentException("SentryOptions are required to send envelopes.");
}
HttpURLConnection o = o(u());
try {
OutputStream outputStream = o.getOutputStream();
try {
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
try {
this.d.getSerializer().b(y1, gZIPOutputStream);
gZIPOutputStream.close();
if (outputStream != null) {
outputStream.close();
}
this.e.c(B2.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(o.getResponseCode()));
} finally {
}
} finally {
}
} catch (Throwable th) {
try {
this.e.b(B2.ERROR, "An exception occurred while submitting the envelope to the Sentry server.", th);
this.e.c(B2.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(o.getResponseCode()));
} catch (Throwable th2) {
this.e.c(B2.DEBUG, "Envelope sent to spotlight: %d", Integer.valueOf(o.getResponseCode()));
m(o);
throw th2;
}
}
m(o);
} catch (Exception e) {
this.e.b(B2.ERROR, "An exception occurred while creating the connection to spotlight.", e);
}
}
private void m(HttpURLConnection httpURLConnection) {
try {
httpURLConnection.getInputStream().close();
} catch (IOException unused) {
} catch (Throwable th) {
httpURLConnection.disconnect();
throw th;
}
httpURLConnection.disconnect();
}
@Override
public void c(final Y1 y1, I i) {
try {
this.i.submit(new Runnable() {
@Override
public final void run() {
SpotlightIntegration.this.v(y1);
}
});
} catch (RejectedExecutionException e) {
this.e.b(B2.WARNING, "Spotlight envelope submission rejected.", e);
}
}
@Override
public void close() {
this.i.a(0L);
L2 l2 = this.d;
if (l2 == null || l2.getBeforeEnvelopeCallback() != this) {
return;
}
this.d.setBeforeEnvelopeCallback(null);
}
@Override
public void h(InterfaceC1686a0 interfaceC1686a0, L2 l2) {
this.d = l2;
this.e = l2.getLogger();
if (l2.getBeforeEnvelopeCallback() != null || !l2.isEnableSpotlight()) {
this.e.c(B2.DEBUG, "SpotlightIntegration is not enabled. BeforeEnvelopeCallback is already set or spotlight is not enabled.", new Object[0]);
return;
}
this.i = new C1832w2();
l2.setBeforeEnvelopeCallback(this);
this.e.c(B2.DEBUG, "SpotlightIntegration enabled.", new Object[0]);
}
public String u() {
L2 l2 = this.d;
return (l2 == null || l2.getSpotlightConnectionUrl() == null) ? io.sentry.util.x.a() ? "http://10.0.2.2:8969/stream" : "http://localhost:8969/stream" : this.d.getSpotlightConnectionUrl();
}
private HttpURLConnection o(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(vMPrSZAj.RjYgJ, "gzip");
httpURLConnection.setRequestProperty("Content-Type", "application/x-sentry-envelope");
httpURLConnection.setRequestProperty("Accept", "application/json");
httpURLConnection.setRequestProperty("Connection", "close");
httpURLConnection.connect();
return httpURLConnection;
}
}