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

366 lines
8 KiB
Smali

.class final Lio/sentry/Dsn;
.super Ljava/lang/Object;
.source "Dsn.java"
# instance fields
.field private final path:Ljava/lang/String;
.field private final projectId:Ljava/lang/String;
.field private final publicKey:Ljava/lang/String;
.field private final secretKey:Ljava/lang/String;
.field private final sentryUri:Ljava/net/URI;
# direct methods
.method constructor <init>(Ljava/lang/String;)V
.locals 10
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/IllegalArgumentException;
}
.end annotation
const-string v0, "/"
const-string v1, "Invalid DSN scheme: "
.line 51
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
:try_start_0
const-string v2, "The DSN is required."
.line 53
invoke-static {p1, v2}, Lio/sentry/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
.line 54
new-instance v2, Ljava/net/URI;
invoke-direct {v2, p1}, Ljava/net/URI;-><init>(Ljava/lang/String;)V
invoke-virtual {v2}, Ljava/net/URI;->normalize()Ljava/net/URI;
move-result-object p1
.line 55
invoke-virtual {p1}, Ljava/net/URI;->getScheme()Ljava/lang/String;
move-result-object v3
const-string v2, "http"
.line 56
invoke-virtual {v2, v3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v2
if-nez v2, :cond_1
const-string v2, "https"
invoke-virtual {v2, v3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_0
goto :goto_0
.line 57
:cond_0
new-instance p0, Ljava/lang/IllegalArgumentException;
new-instance p1, Ljava/lang/StringBuilder;
invoke-direct {p1, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.line 60
:cond_1
:goto_0
invoke-virtual {p1}, Ljava/net/URI;->getUserInfo()Ljava/lang/String;
move-result-object v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const-string v2, "Invalid DSN: No public key provided."
if-eqz v1, :cond_7
.line 61
:try_start_1
invoke-virtual {v1}, Ljava/lang/String;->isEmpty()Z
move-result v4
if-nez v4, :cond_7
const-string v4, ":"
const/4 v5, -0x1
.line 64
invoke-virtual {v1, v4, v5}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;
move-result-object v1
const/4 v4, 0x0
.line 65
aget-object v5, v1, v4
iput-object v5, p0, Lio/sentry/Dsn;->publicKey:Ljava/lang/String;
if-eqz v5, :cond_6
.line 66
invoke-virtual {v5}, Ljava/lang/String;->isEmpty()Z
move-result v5
if-nez v5, :cond_6
.line 69
array-length v2, v1
const/4 v5, 0x1
if-le v2, v5, :cond_2
aget-object v1, v1, v5
goto :goto_1
:cond_2
const/4 v1, 0x0
:goto_1
iput-object v1, p0, Lio/sentry/Dsn;->secretKey:Ljava/lang/String;
.line 70
invoke-virtual {p1}, Ljava/net/URI;->getPath()Ljava/lang/String;
move-result-object v1
.line 71
invoke-virtual {v1, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_3
.line 72
invoke-virtual {v1}, Ljava/lang/String;->length()I
move-result v2
sub-int/2addr v2, v5
invoke-virtual {v1, v4, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;
move-result-object v1
.line 74
:cond_3
invoke-virtual {v1, v0}, Ljava/lang/String;->lastIndexOf(Ljava/lang/String;)I
move-result v2
add-int/2addr v2, v5
.line 75
invoke-virtual {v1, v4, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;
move-result-object v4
.line 76
invoke-virtual {v4, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v5
if-nez v5, :cond_4
.line 77
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v5, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
:cond_4
iput-object v4, p0, Lio/sentry/Dsn;->path:Ljava/lang/String;
.line 80
invoke-virtual {v1, v2}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lio/sentry/Dsn;->projectId:Ljava/lang/String;
.line 81
invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z
move-result v1
if-nez v1, :cond_5
.line 84
new-instance v1, Ljava/net/URI;
const/4 v5, 0x0
.line 86
invoke-virtual {p1}, Ljava/net/URI;->getHost()Ljava/lang/String;
move-result-object v6
invoke-virtual {p1}, Ljava/net/URI;->getPort()I
move-result p1
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
const-string v4, "api/"
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v7
const/4 v8, 0x0
const/4 v9, 0x0
move-object v2, v1
move-object v4, v5
move-object v5, v6
move v6, p1
invoke-direct/range {v2 .. v9}, Ljava/net/URI;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
iput-object v1, p0, Lio/sentry/Dsn;->sentryUri:Ljava/net/URI;
return-void
.line 82
:cond_5
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "Invalid DSN: A Project Id is required."
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.line 67
:cond_6
new-instance p0, Ljava/lang/IllegalArgumentException;
invoke-direct {p0, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.line 62
:cond_7
new-instance p0, Ljava/lang/IllegalArgumentException;
invoke-direct {p0, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:catchall_0
move-exception p0
.line 88
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/Throwable;)V
throw p1
.end method
# virtual methods
.method public getPath()Ljava/lang/String;
.locals 0
iget-object p0, p0, Lio/sentry/Dsn;->path:Ljava/lang/String;
return-object p0
.end method
.method public getProjectId()Ljava/lang/String;
.locals 0
iget-object p0, p0, Lio/sentry/Dsn;->projectId:Ljava/lang/String;
return-object p0
.end method
.method public getPublicKey()Ljava/lang/String;
.locals 0
iget-object p0, p0, Lio/sentry/Dsn;->publicKey:Ljava/lang/String;
return-object p0
.end method
.method public getSecretKey()Ljava/lang/String;
.locals 0
iget-object p0, p0, Lio/sentry/Dsn;->secretKey:Ljava/lang/String;
return-object p0
.end method
.method getSentryUri()Ljava/net/URI;
.locals 0
iget-object p0, p0, Lio/sentry/Dsn;->sentryUri:Ljava/net/URI;
return-object p0
.end method