Rabbit-R1/switch port/smali/smali_classes3/io/sentry/util/JsonSerializationUtils.smali
2024-05-21 17:08:36 -04:00

299 lines
7.1 KiB
Smali

.class public final Lio/sentry/util/JsonSerializationUtils;
.super Ljava/lang/Object;
.source "JsonSerializationUtils.java"
# static fields
.field private static final UTF_8:Ljava/nio/charset/Charset;
# direct methods
.method static constructor <clinit>()V
.locals 1
const-string v0, "UTF-8"
.line 26
invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object v0
sput-object v0, Lio/sentry/util/JsonSerializationUtils;->UTF_8:Ljava/nio/charset/Charset;
return-void
.end method
.method public constructor <init>()V
.locals 0
.line 23
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static atomicIntegerArrayToList(Ljava/util/concurrent/atomic/AtomicIntegerArray;)Ljava/util/List;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/concurrent/atomic/AtomicIntegerArray;",
")",
"Ljava/util/List<",
"Ljava/lang/Object;",
">;"
}
.end annotation
.line 43
invoke-virtual {p0}, Ljava/util/concurrent/atomic/AtomicIntegerArray;->length()I
move-result v0
.line 44
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1, v0}, Ljava/util/ArrayList;-><init>(I)V
const/4 v2, 0x0
:goto_0
if-ge v2, v0, :cond_0
.line 46
invoke-virtual {p0, v2}, Ljava/util/concurrent/atomic/AtomicIntegerArray;->get(I)I
move-result v3
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_0
return-object v1
.end method
.method public static bytesFrom(Lio/sentry/ISerializer;Lio/sentry/ILogger;Lio/sentry/JsonSerializable;)[B
.locals 4
.line 56
:try_start_0
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_4
.line 57
:try_start_1
new-instance v1, Ljava/io/BufferedWriter;
new-instance v2, Ljava/io/OutputStreamWriter;
sget-object v3, Lio/sentry/util/JsonSerializationUtils;->UTF_8:Ljava/nio/charset/Charset;
invoke-direct {v2, v0, v3}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;Ljava/nio/charset/Charset;)V
invoke-direct {v1, v2}, Ljava/io/BufferedWriter;-><init>(Ljava/io/Writer;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_2
.line 59
:try_start_2
invoke-interface {p0, p2, v1}, Lio/sentry/ISerializer;->serialize(Ljava/lang/Object;Ljava/io/Writer;)V
.line 61
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object p0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
.line 62
:try_start_3
invoke-virtual {v1}, Ljava/io/Writer;->close()V
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_2
:try_start_4
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->close()V
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_4
return-object p0
:catchall_0
move-exception p0
.line 56
:try_start_5
invoke-virtual {v1}, Ljava/io/Writer;->close()V
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_1
goto :goto_0
:catchall_1
move-exception p2
:try_start_6
invoke-virtual {p0, p2}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
:goto_0
throw p0
:try_end_6
.catchall {:try_start_6 .. :try_end_6} :catchall_2
:catchall_2
move-exception p0
:try_start_7
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->close()V
:try_end_7
.catchall {:try_start_7 .. :try_end_7} :catchall_3
goto :goto_1
:catchall_3
move-exception p2
:try_start_8
invoke-virtual {p0, p2}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
:goto_1
throw p0
:try_end_8
.catchall {:try_start_8 .. :try_end_8} :catchall_4
:catchall_4
move-exception p0
.line 64
sget-object p2, Lio/sentry/SentryLevel;->ERROR:Lio/sentry/SentryLevel;
const-string v0, "Could not serialize serializable"
invoke-interface {p1, p2, v0, p0}, Lio/sentry/ILogger;->log(Lio/sentry/SentryLevel;Ljava/lang/String;Ljava/lang/Throwable;)V
const/4 p0, 0x0
return-object p0
.end method
.method public static calendarToMap(Ljava/util/Calendar;)Ljava/util/Map;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Calendar;",
")",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.line 29
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
const/4 v1, 0x1
.line 31
invoke-virtual {p0, v1}, Ljava/util/Calendar;->get(I)I
move-result v1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
const-string v2, "year"
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const/4 v1, 0x2
.line 32
invoke-virtual {p0, v1}, Ljava/util/Calendar;->get(I)I
move-result v1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
const-string v2, "month"
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const/4 v1, 0x5
.line 33
invoke-virtual {p0, v1}, Ljava/util/Calendar;->get(I)I
move-result v1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
const-string v2, "dayOfMonth"
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const/16 v1, 0xb
.line 34
invoke-virtual {p0, v1}, Ljava/util/Calendar;->get(I)I
move-result v1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
const-string v2, "hourOfDay"
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const/16 v1, 0xc
.line 35
invoke-virtual {p0, v1}, Ljava/util/Calendar;->get(I)I
move-result v1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
const-string v2, "minute"
invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const/16 v1, 0xd
.line 36
invoke-virtual {p0, v1}, Ljava/util/Calendar;->get(I)I
move-result p0
invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p0
const-string v1, "second"
invoke-interface {v0, v1, p0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
return-object v0
.end method