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

207 lines
5.2 KiB
Smali

.class final Lio/sentry/config/EnvironmentVariablePropertiesProvider;
.super Ljava/lang/Object;
.source "EnvironmentVariablePropertiesProvider.java"
# interfaces
.implements Lio/sentry/config/PropertiesProvider;
# static fields
.field private static final PREFIX:Ljava/lang/String; = "SENTRY"
# direct methods
.method constructor <init>()V
.locals 0
.line 14
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private propertyToEnvironmentVariableName(Ljava/lang/String;)Ljava/lang/String;
.locals 2
.line 50
new-instance p0, Ljava/lang/StringBuilder;
const-string v0, "SENTRY_"
invoke-direct {p0, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
const-string v0, "."
const-string v1, "_"
invoke-virtual {p1, v0, v1}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object p1
const-string v0, "-"
invoke-virtual {p1, v0, v1}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object p1
sget-object v0, Ljava/util/Locale;->ROOT:Ljava/util/Locale;
invoke-virtual {p1, v0}, Ljava/lang/String;->toUpperCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object p1
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
return-object p0
.end method
# virtual methods
.method public getMap(Ljava/lang/String;)Ljava/util/Map;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
")",
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/String;",
">;"
}
.end annotation
.line 34
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
invoke-direct {p0, p1}, Lio/sentry/config/EnvironmentVariablePropertiesProvider;->propertyToEnvironmentVariableName(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
const-string p1, "_"
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
.line 36
new-instance p1, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {p1}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
.line 37
invoke-static {}, Ljava/lang/System;->getenv()Ljava/util/Map;
move-result-object v0
invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object v0
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v0
:cond_0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
.line 38
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/String;
.line 39
invoke-virtual {v2, p0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v3
if-eqz v3, :cond_0
.line 40
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/String;
const-string v3, "\""
invoke-static {v1, v3}, Lio/sentry/util/StringUtils;->removeSurrounding(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
if-eqz v1, :cond_0
.line 42
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v3
invoke-virtual {v2, v3}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object v2
sget-object v3, Ljava/util/Locale;->ROOT:Ljava/util/Locale;
invoke-virtual {v2, v3}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v2
invoke-interface {p1, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
:cond_1
return-object p1
.end method
.method public getProperty(Ljava/lang/String;)Ljava/lang/String;
.locals 0
.line 20
invoke-direct {p0, p1}, Lio/sentry/config/EnvironmentVariablePropertiesProvider;->propertyToEnvironmentVariableName(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
invoke-static {p0}, Ljava/lang/System;->getenv(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
const-string p1, "\""
.line 19
invoke-static {p0, p1}, Lio/sentry/util/StringUtils;->removeSurrounding(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
return-object p0
.end method