Rabbit-R1/original r1/smali/smali_classes3/io/sentry/DuplicateEventDetectionEventProcessor.smali
2024-05-21 17:08:36 -04:00

253 lines
6.2 KiB
Smali

.class public final Lio/sentry/DuplicateEventDetectionEventProcessor;
.super Ljava/lang/Object;
.source "DuplicateEventDetectionEventProcessor.java"
# interfaces
.implements Lio/sentry/EventProcessor;
# instance fields
.field private final capturedObjects:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Throwable;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field private final options:Lio/sentry/SentryOptions;
# direct methods
.method public constructor <init>(Lio/sentry/SentryOptions;)V
.locals 1
.line 18
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 14
new-instance v0, Ljava/util/WeakHashMap;
invoke-direct {v0}, Ljava/util/WeakHashMap;-><init>()V
.line 15
invoke-static {v0}, Ljava/util/Collections;->synchronizedMap(Ljava/util/Map;)Ljava/util/Map;
move-result-object v0
iput-object v0, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->capturedObjects:Ljava/util/Map;
const-string v0, "options are required"
.line 19
invoke-static {p1, v0}, Lio/sentry/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lio/sentry/SentryOptions;
iput-object p1, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->options:Lio/sentry/SentryOptions;
return-void
.end method
.method private static allCauses(Ljava/lang/Throwable;)Ljava/util/List;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Throwable;",
")",
"Ljava/util/List<",
"Ljava/lang/Throwable;",
">;"
}
.end annotation
.line 57
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 59
:goto_0
invoke-virtual {p0}, Ljava/lang/Throwable;->getCause()Ljava/lang/Throwable;
move-result-object v1
if-eqz v1, :cond_0
.line 60
invoke-virtual {p0}, Ljava/lang/Throwable;->getCause()Ljava/lang/Throwable;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 61
invoke-virtual {p0}, Ljava/lang/Throwable;->getCause()Ljava/lang/Throwable;
move-result-object p0
goto :goto_0
:cond_0
return-object v0
.end method
.method private static containsAnyKey(Ljava/util/Map;Ljava/util/List;)Z
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/util/Map<",
"TT;",
"Ljava/lang/Object;",
">;",
"Ljava/util/List<",
"TT;>;)Z"
}
.end annotation
.line 48
invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object p1
:cond_0
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_1
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
.line 49
invoke-interface {p0, v0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
const/4 p0, 0x1
return p0
:cond_1
const/4 p0, 0x0
return p0
.end method
# virtual methods
.method public process(Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
.locals 3
iget-object p2, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->options:Lio/sentry/SentryOptions;
.line 24
invoke-virtual {p2}, Lio/sentry/SentryOptions;->isEnableDeduplication()Z
move-result p2
if-eqz p2, :cond_2
.line 25
invoke-virtual {p1}, Lio/sentry/SentryEvent;->getThrowable()Ljava/lang/Throwable;
move-result-object p2
if-eqz p2, :cond_3
iget-object v0, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->capturedObjects:Ljava/util/Map;
.line 27
invoke-interface {v0, p2}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
const/4 v1, 0x0
if-nez v0, :cond_1
iget-object v0, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->capturedObjects:Ljava/util/Map;
.line 28
invoke-static {p2}, Lio/sentry/DuplicateEventDetectionEventProcessor;->allCauses(Ljava/lang/Throwable;)Ljava/util/List;
move-result-object v2
invoke-static {v0, v2}, Lio/sentry/DuplicateEventDetectionEventProcessor;->containsAnyKey(Ljava/util/Map;Ljava/util/List;)Z
move-result v0
if-eqz v0, :cond_0
goto :goto_0
:cond_0
iget-object p0, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->capturedObjects:Ljava/util/Map;
.line 37
invoke-interface {p0, p2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_1
:cond_1
:goto_0
iget-object p0, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->options:Lio/sentry/SentryOptions;
.line 30
invoke-virtual {p0}, Lio/sentry/SentryOptions;->getLogger()Lio/sentry/ILogger;
move-result-object p0
sget-object p2, Lio/sentry/SentryLevel;->DEBUG:Lio/sentry/SentryLevel;
.line 34
invoke-virtual {p1}, Lio/sentry/SentryEvent;->getEventId()Lio/sentry/protocol/SentryId;
move-result-object p1
filled-new-array {p1}, [Ljava/lang/Object;
move-result-object p1
const-string v0, "Duplicate Exception detected. Event %s will be discarded."
.line 31
invoke-interface {p0, p2, v0, p1}, Lio/sentry/ILogger;->log(Lio/sentry/SentryLevel;Ljava/lang/String;[Ljava/lang/Object;)V
return-object v1
:cond_2
iget-object p0, p0, Lio/sentry/DuplicateEventDetectionEventProcessor;->options:Lio/sentry/SentryOptions;
.line 41
invoke-virtual {p0}, Lio/sentry/SentryOptions;->getLogger()Lio/sentry/ILogger;
move-result-object p0
sget-object p2, Lio/sentry/SentryLevel;->DEBUG:Lio/sentry/SentryLevel;
const/4 v0, 0x0
new-array v0, v0, [Ljava/lang/Object;
const-string v1, "Event deduplication is disabled."
invoke-interface {p0, p2, v1, v0}, Lio/sentry/ILogger;->log(Lio/sentry/SentryLevel;Ljava/lang/String;[Ljava/lang/Object;)V
:cond_3
:goto_1
return-object p1
.end method