正在查看: BodyTech v7.6.4 应用的 DefaultErrorReporter.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 DefaultErrorReporter.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.stripe3ds2.observability;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Build;
import androidx.annotation.VisibleForTesting;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.JSONObjectInstrumentation;
import com.newrelic.agent.android.instrumentation.URLConnectionInstrumentation;
import com.stripe.android.stripe3ds2.transaction.z;
import gj.i;
import io.ktor.http.ContentDisposition;
import io.ktor.http.LinkHeader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Result;
import kotlin.Unit;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.g0;
import kotlin.collections.o;
import kotlin.coroutines.CoroutineContext;
import kotlin.f;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.r;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScopeKt;
import org.json.JSONArray;
import org.json.JSONObject;
@Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u0003\n\u0002\b\t\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\f\b\u0000\u0018\u0000 \u000b2\u00020\u0001:\u000301\u000bBU\u0012\u0006\u0010\u001b\u001a\u00020\u001a\u0012\b\b\u0002\u0010\u001e\u001a\u00020\u001d\u0012\b\b\u0002\u0010!\u001a\u00020 \u0012\b\b\u0002\u0010$\u001a\u00020#\u0012\b\b\u0002\u0010'\u001a\u00020&\u0012\b\b\u0002\u0010)\u001a\u00020\u0017\u0012\b\b\u0002\u0010+\u001a\u00020\u0017\u0012\b\b\u0002\u0010,\u001a\u00020\b¢\u0006\u0004\b.\u0010/J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0002J\u0018\u0010\n\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\bH\u0002J\b\u0010\u000b\u001a\u00020\u0006H\u0002J\b\u0010\f\u001a\u00020\u0006H\u0002J\u0010\u0010\u000f\u001a\u00020\u00042\u0006\u0010\u000e\u001a\u00020\rH\u0002J\u0010\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0010\u001a\u00020\rH\u0016J\u0017\u0010\u0012\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\rH\u0001¢\u0006\u0004\b\u0012\u0010\u0013J\u000f\u0010\u0014\u001a\u00020\u0002H\u0001¢\u0006\u0004\b\u0014\u0010\u0015J\u0017\u0010\u0016\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\rH\u0001¢\u0006\u0004\b\u0016\u0010\u0013J\u000f\u0010\u0018\u001a\u00020\u0017H\u0001¢\u0006\u0004\b\u0018\u0010\u0019R\u0014\u0010\u001b\u001a\u00020\u001a8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001b\u0010\u001cR\u0014\u0010\u001e\u001a\u00020\u001d8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001e\u0010\u001fR\u0014\u0010!\u001a\u00020 8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b!\u0010\"R\u0014\u0010$\u001a\u00020#8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b$\u0010%R\u0014\u0010'\u001a\u00020&8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b'\u0010(R\u0014\u0010)\u001a\u00020\u00178\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b)\u0010*R\u0014\u0010+\u001a\u00020\u00178\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b+\u0010*R\u0014\u0010,\u001a\u00020\b8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b,\u0010-¨\u00062"}, d2 = {"Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter;", "Lcom/stripe/android/stripe3ds2/observability/ErrorReporter;", "Lorg/json/JSONObject;", "requestBody", "", "k", "Ljavax/net/ssl/HttpsURLConnection;", "connection", "", "responseCode", "h", "c", "j", "", "exception", "i", "t", "O", "d", "(Ljava/lang/Throwable;)Lorg/json/JSONObject;", "e", "()Lorg/json/JSONObject;", "f", "", "g", "()Ljava/lang/String;", "Landroid/content/Context;", "context", "Landroid/content/Context;", "Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$b;", "config", "Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$b;", "Lkotlin/coroutines/CoroutineContext;", "workContext", "Lkotlin/coroutines/CoroutineContext;", "Lcom/stripe/android/stripe3ds2/transaction/z;", "logger", "Lcom/stripe/android/stripe3ds2/transaction/z;", "Lcom/stripe/android/stripe3ds2/observability/b;", "sentryConfig", "Lcom/stripe/android/stripe3ds2/observability/b;", "environment", "Ljava/lang/String;", "localeCountry", "osVersion", "I", "<init>", "(Landroid/content/Context;Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$b;Lkotlin/coroutines/CoroutineContext;Lcom/stripe/android/stripe3ds2/transaction/z;Lcom/stripe/android/stripe3ds2/observability/b;Ljava/lang/String;Ljava/lang/String;I)V", "a", "b", "3ds2sdk_release"}, k = 1, mv = {1, 9, 0})
@Instrumented
public final class DefaultErrorReporter implements ErrorReporter {
private static final a c = new a(null);
private static final String d = StandardCharsets.UTF_8.name();
private final b config;
private final Context context;
private final String environment;
private final String localeCountry;
private final z logger;
private final int osVersion;
private final com.stripe.android.stripe3ds2.observability.b sentryConfig;
private final CoroutineContext workContext;
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\r\b\u0082\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\r\u0010\u000eR\u001c\u0010\u0004\u001a\n \u0003*\u0004\u0018\u00010\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0004\u0010\u0005R\u0014\u0010\u0006\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0006\u0010\u0005R\u0014\u0010\u0007\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0007\u0010\u0005R\u0014\u0010\b\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\b\u0010\u0005R\u0014\u0010\t\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\t\u0010\u0005R\u0014\u0010\n\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\n\u0010\u0005R\u0014\u0010\u000b\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000b\u0010\u0005R\u0014\u0010\f\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\f\u0010\u0005¨\u0006\u000f"}, d2 = {"Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$a;", "", "", "kotlin.jvm.PlatformType", "CHARSET", "Ljava/lang/String;", "CONTENT_TYPE", "HEADER_CONTENT_TYPE", "HEADER_SENTRY_AUTH", "HEADER_USER_AGENT", "HOST", "HTTP_METHOD", "USER_AGENT", "<init>", "()V", "3ds2sdk_release"}, k = 1, mv = {1, 9, 0})
private static final class a {
private a() {
}
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0004\bf\u0018\u00002\u00020\u0001R \u0010\u0006\u001a\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00028&X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0004\u0010\u0005ø\u0001\u0000\u0082\u0002\u0006\n\u0004\b!0\u0001¨\u0006\u0007À\u0006\u0001"}, d2 = {"Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$b;", "", "", "", "b", "()Ljava/util/Map;", "customTags", "3ds2sdk_release"}, k = 1, mv = {1, 9, 0})
public interface b {
Map<String, String> b();
}
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\b\bÀ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\t\u0010\nR&\u0010\b\u001a\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00028\u0016X\u0096\u0004¢\u0006\f\n\u0004\b\u0004\u0010\u0005\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u000b"}, d2 = {"Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$c;", "Lcom/stripe/android/stripe3ds2/observability/DefaultErrorReporter$b;", "", "", "d", "Ljava/util/Map;", "b", "()Ljava/util/Map;", "customTags", "<init>", "()V", "3ds2sdk_release"}, k = 1, mv = {1, 9, 0})
public static final class c implements b {
public static final c c = new c();
private static final Map<String, String> customTags;
static {
Map<String, String> j;
j = g0.j();
customTags = j;
}
private c() {
}
@Override
public Map<String, String> b() {
return customTags;
}
}
public DefaultErrorReporter(Context context, b config, CoroutineContext workContext, z logger, com.stripe.android.stripe3ds2.observability.b sentryConfig, String environment, String localeCountry, int i) {
r.i(context, "context");
r.i(config, "config");
r.i(workContext, "workContext");
r.i(logger, "logger");
r.i(sentryConfig, "sentryConfig");
r.i(environment, "environment");
r.i(localeCountry, "localeCountry");
this.context = context;
this.config = config;
this.workContext = workContext;
this.logger = logger;
this.sentryConfig = sentryConfig;
this.environment = environment;
this.localeCountry = localeCountry;
this.osVersion = i;
}
private final HttpsURLConnection c() {
Map n;
HttpsURLConnection j = j();
j.setRequestMethod("POST");
j.setDoOutput(true);
n = g0.n(i.a("Content-Type", "application/json; charset=utf-8"), i.a("User-Agent", "Android3ds2Sdk 6.1.8"), i.a("X-Sentry-Auth", g()));
for (Map.Entry entry : n.entrySet()) {
j.setRequestProperty((String) entry.getKey(), (String) entry.getValue());
}
return j;
}
public final void i(Throwable exception) {
this.logger.a("Failed to send error report.", exception);
}
private final HttpsURLConnection j() {
URLConnection openConnection = URLConnectionInstrumentation.openConnection(new URL("https://errors.stripe.com/api/" + this.sentryConfig.b() + "/store/").openConnection());
r.g(openConnection, "null cannot be cast to non-null type javax.net.ssl.HttpsURLConnection");
return (HttpsURLConnection) openConnection;
}
public final void k(JSONObject requestBody) {
HttpsURLConnection c2 = c();
OutputStream outputStream = c2.getOutputStream();
try {
r.f(outputStream);
Charset UTF_8 = StandardCharsets.UTF_8;
r.h(UTF_8, "UTF_8");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, UTF_8);
try {
outputStreamWriter.write(!(requestBody instanceof JSONObject) ? requestBody.toString() : JSONObjectInstrumentation.toString(requestBody));
outputStreamWriter.flush();
Unit unit = Unit.a;
kotlin.io.b.a(outputStreamWriter, null);
kotlin.io.b.a(outputStream, null);
c2.connect();
h(c2, c2.getResponseCode());
c2.disconnect();
} finally {
}
} finally {
}
}
@Override
public void O(Throwable t) {
r.i(t, "t");
BuildersKt__Builders_commonKt.launch$default(CoroutineScopeKt.CoroutineScope(this.workContext), null, null, new DefaultErrorReporter$reportError$1(this, t, null), 3, null);
}
@VisibleForTesting
public final JSONObject d(Throwable t) {
r.i(t, "t");
JSONObject put = new JSONObject().put("release", "[email protected]+25");
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
JSONObject put2 = new JSONObject().put(LinkHeader.Parameters.Type, t.getClass().getCanonicalName());
String message = t.getMessage();
if (message == null) {
message = "";
}
JSONObject put3 = put.put("exception", jSONObject.put("values", jSONArray.put(put2.put("value", message).put("stacktrace", f(t)))));
JSONObject put4 = new JSONObject().put("locale", this.localeCountry).put("environment", this.environment).put("android_os_version", this.osVersion);
for (Map.Entry<String, String> entry : this.config.b().entrySet()) {
put4.put(entry.getKey(), entry.getValue());
}
Unit unit = Unit.a;
JSONObject put5 = put3.put("tags", put4).put("contexts", e());
r.h(put5, "put(...)");
return put5;
}
@VisibleForTesting
public final JSONObject e() {
Object b2;
ApplicationInfo applicationInfo;
try {
Result.Companion companion = Result.INSTANCE;
b2 = Result.b(this.context.getPackageManager().getPackageInfo(this.context.getPackageName(), 0));
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
b2 = Result.b(f.a(th2));
}
if (Result.g(b2)) {
b2 = null;
}
PackageInfo packageInfo = (PackageInfo) b2;
CharSequence loadLabel = (packageInfo == null || (applicationInfo = packageInfo.applicationInfo) == null) ? null : applicationInfo.loadLabel(this.context.getPackageManager());
JSONObject jSONObject = new JSONObject();
JSONObject put = new JSONObject().put("app_identifier", this.context.getPackageName()).put("app_name", loadLabel);
String str = packageInfo != null ? packageInfo.versionName : null;
if (str == null) {
str = "";
}
JSONObject put2 = jSONObject.put("app", put.put("app_version", str));
JSONObject put3 = new JSONObject().put(ContentDisposition.Parameters.Name, "Android").put("version", Build.VERSION.RELEASE);
String str2 = Build.TYPE;
JSONObject put4 = put2.put("os", put3.put(LinkHeader.Parameters.Type, str2).put("build", Build.DISPLAY));
JSONObject put5 = new JSONObject().put("model_id", Build.ID).put("model", Build.MODEL).put("manufacturer", Build.MANUFACTURER).put(LinkHeader.Parameters.Type, str2);
JSONArray jSONArray = new JSONArray();
String[] SUPPORTED_ABIS = Build.SUPPORTED_ABIS;
r.h(SUPPORTED_ABIS, "SUPPORTED_ABIS");
for (String str3 : SUPPORTED_ABIS) {
jSONArray.put(str3);
}
Unit unit = Unit.a;
JSONObject put6 = put4.put("device", put5.put("archs", jSONArray));
r.h(put6, "put(...)");
return put6;
}
@VisibleForTesting
public final JSONObject f(Throwable t) {
List<StackTraceElement> U0;
r.i(t, "t");
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
StackTraceElement[] stackTrace = t.getStackTrace();
r.h(stackTrace, "getStackTrace(...)");
U0 = ArraysKt___ArraysKt.U0(stackTrace);
for (StackTraceElement stackTraceElement : U0) {
jSONArray.put(new JSONObject().put("lineno", stackTraceElement.getLineNumber()).put(ContentDisposition.Parameters.FileName, stackTraceElement.getClassName()).put("function", stackTraceElement.getMethodName()));
}
Unit unit = Unit.a;
JSONObject put = jSONObject.put("frames", jSONArray);
r.h(put, "put(...)");
return put;
}
@VisibleForTesting
public final String g() {
List q;
String D0;
List q2;
String D02;
q = o.q(i.a("sentry_key", this.sentryConfig.getKey()), i.a("sentry_version", this.sentryConfig.getVersion()), i.a("sentry_timestamp", this.sentryConfig.a()), i.a("sentry_client", "Android3ds2Sdk 6.1.8"), i.a("sentry_secret", this.sentryConfig.c()));
D0 = CollectionsKt___CollectionsKt.D0(q, ", ", null, null, 0, null, new Function1<Pair<? extends String, ? extends String>, CharSequence>() {
public final CharSequence invoke2(Pair<String, String> pair) {
r.i(pair, "<name for destructuring parameter 0>");
return pair.a() + "=" + pair.b();
}
@Override
public CharSequence invoke(Pair<? extends String, ? extends String> pair) {
return invoke2((Pair<String, String>) pair);
}
}, 30, null);
q2 = o.q("Sentry", D0);
D02 = CollectionsKt___CollectionsKt.D0(q2, " ", null, null, 0, null, null, 62, null);
return D02;
}
public DefaultErrorReporter(android.content.Context r9, com.stripe.android.stripe3ds2.observability.DefaultErrorReporter.b r10, kotlin.coroutines.CoroutineContext r11, com.stripe.android.stripe3ds2.transaction.z r12, com.stripe.android.stripe3ds2.observability.b r13, java.lang.String r14, java.lang.String r15, int r16, int r17, kotlin.jvm.internal.DefaultConstructorMarker r18) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.stripe3ds2.observability.DefaultErrorReporter.<init>(android.content.Context, com.stripe.android.stripe3ds2.observability.DefaultErrorReporter$b, kotlin.coroutines.CoroutineContext, com.stripe.android.stripe3ds2.transaction.z, com.stripe.android.stripe3ds2.observability.b, java.lang.String, java.lang.String, int, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
private final void h(HttpsURLConnection connection, int responseCode) {
}
}