Rabbit-R1/switch port/java/sources/io/sentry/protocol/SentryStackTrace.java
2024-05-21 17:08:36 -04:00

151 lines
5.3 KiB
Java

package io.sentry.protocol;
import io.sentry.ILogger;
import io.sentry.JsonDeserializer;
import io.sentry.JsonObjectReader;
import io.sentry.JsonSerializable;
import io.sentry.JsonUnknown;
import io.sentry.ObjectWriter;
import io.sentry.protocol.SentryStackFrame;
import io.sentry.util.CollectionUtils;
import io.sentry.vendor.gson.stream.JsonToken;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/* loaded from: classes3.dex */
public final class SentryStackTrace implements JsonUnknown, JsonSerializable {
private List<SentryStackFrame> frames;
private Map<String, String> registers;
private Boolean snapshot;
private Map<String, Object> unknown;
/* loaded from: classes3.dex */
public static final class JsonKeys {
public static final String FRAMES = "frames";
public static final String REGISTERS = "registers";
public static final String SNAPSHOT = "snapshot";
}
public List<SentryStackFrame> getFrames() {
return this.frames;
}
public Map<String, String> getRegisters() {
return this.registers;
}
public Boolean getSnapshot() {
return this.snapshot;
}
@Override // io.sentry.JsonUnknown
public Map<String, Object> getUnknown() {
return this.unknown;
}
public void setFrames(List<SentryStackFrame> list) {
this.frames = list;
}
public void setRegisters(Map<String, String> map) {
this.registers = map;
}
public void setSnapshot(Boolean bool) {
this.snapshot = bool;
}
@Override // io.sentry.JsonUnknown
public void setUnknown(Map<String, Object> map) {
this.unknown = map;
}
public SentryStackTrace() {
}
public SentryStackTrace(List<SentryStackFrame> list) {
this.frames = list;
}
@Override // io.sentry.JsonSerializable
public void serialize(ObjectWriter objectWriter, ILogger iLogger) throws IOException {
objectWriter.beginObject();
if (this.frames != null) {
objectWriter.name(JsonKeys.FRAMES).value(iLogger, this.frames);
}
if (this.registers != null) {
objectWriter.name(JsonKeys.REGISTERS).value(iLogger, this.registers);
}
if (this.snapshot != null) {
objectWriter.name(JsonKeys.SNAPSHOT).value(this.snapshot);
}
Map<String, Object> map = this.unknown;
if (map != null) {
for (String str : map.keySet()) {
Object obj = this.unknown.get(str);
objectWriter.name(str);
objectWriter.value(iLogger, obj);
}
}
objectWriter.endObject();
}
/* loaded from: classes3.dex */
public static final class Deserializer implements JsonDeserializer<SentryStackTrace> {
/* JADX WARN: Can't rename method to resolve collision */
/* JADX WARN: Failed to find 'out' block for switch in B:5:0x001d. Please report as an issue. */
@Override // io.sentry.JsonDeserializer
public SentryStackTrace deserialize(JsonObjectReader jsonObjectReader, ILogger iLogger) throws Exception {
SentryStackTrace sentryStackTrace = new SentryStackTrace();
jsonObjectReader.beginObject();
ConcurrentHashMap concurrentHashMap = null;
while (jsonObjectReader.peek() == JsonToken.NAME) {
String nextName = jsonObjectReader.nextName();
nextName.hashCode();
char c = 65535;
switch (nextName.hashCode()) {
case -1266514778:
if (nextName.equals(JsonKeys.FRAMES)) {
c = 0;
break;
}
break;
case 78226992:
if (nextName.equals(JsonKeys.REGISTERS)) {
c = 1;
break;
}
break;
case 284874180:
if (nextName.equals(JsonKeys.SNAPSHOT)) {
c = 2;
break;
}
break;
}
switch (c) {
case 0:
sentryStackTrace.frames = jsonObjectReader.nextListOrNull(iLogger, new SentryStackFrame.Deserializer());
break;
case 1:
sentryStackTrace.registers = CollectionUtils.newConcurrentHashMap((Map) jsonObjectReader.nextObjectOrNull());
break;
case 2:
sentryStackTrace.snapshot = jsonObjectReader.nextBooleanOrNull();
break;
default:
if (concurrentHashMap == null) {
concurrentHashMap = new ConcurrentHashMap();
}
jsonObjectReader.nextUnknown(iLogger, concurrentHashMap, nextName);
break;
}
}
sentryStackTrace.setUnknown(concurrentHashMap);
jsonObjectReader.endObject();
return sentryStackTrace;
}
}
}