ExceptionHelper.smali
.class public final Lio/reactivex/internal/util/ExceptionHelper;
.super Ljava/lang/Object;
.source "ExceptionHelper.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lio/reactivex/internal/util/ExceptionHelper$Termination;
}
.end annotation
# static fields
.field public static final TERMINATED:Ljava/lang/Throwable;
# direct methods
.method static constructor <clinit>()V
.registers 1
.line 52
new-instance v0, Lio/reactivex/internal/util/ExceptionHelper$Termination;
invoke-direct {v0}, Lio/reactivex/internal/util/ExceptionHelper$Termination;-><init>()V
sput-object v0, Lio/reactivex/internal/util/ExceptionHelper;->TERMINATED:Ljava/lang/Throwable;
return-void
.end method
.method private constructor <init>()V
.registers 3
.line 27
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 28
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "No instances!"
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public static addThrowable(Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/Throwable;)Z
.registers 7
.param p1, "exception" # Ljava/lang/Throwable;
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/util/concurrent/atomic/AtomicReference<",
"Ljava/lang/Throwable;",
">;",
"Ljava/lang/Throwable;",
")Z"
}
.end annotation
.line 56
.local p0, "field":Ljava/util/concurrent/atomic/AtomicReference;, "Ljava/util/concurrent/atomic/AtomicReference<Ljava/lang/Throwable;>;"
:goto_0
invoke-virtual {p0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Throwable;
.line 58
.local v0, "current":Ljava/lang/Throwable;
sget-object v1, Lio/reactivex/internal/util/ExceptionHelper;->TERMINATED:Ljava/lang/Throwable;
const/4 v2, 0x0
if-ne v0, v1, :cond_c
.line 59
return v2
.line 63
:cond_c
const/4 v1, 0x1
if-nez v0, :cond_11
.line 64
move-object v2, p1
.local v2, "update":Ljava/lang/Throwable;
goto :goto_1e
.line 66
.end local v2 # "update":Ljava/lang/Throwable;
:cond_11
new-instance v3, Lio/reactivex/exceptions/CompositeException;
const/4 v4, 0x2
new-array v4, v4, [Ljava/lang/Throwable;
aput-object v0, v4, v2
aput-object p1, v4, v1
invoke-direct {v3, v4}, Lio/reactivex/exceptions/CompositeException;-><init>([Ljava/lang/Throwable;)V
move-object v2, v3
.line 69
.restart local v2 # "update":Ljava/lang/Throwable;
:goto_1e
invoke-virtual {p0, v0, v2}, Ljava/util/concurrent/atomic/AtomicReference;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_25
.line 70
return v1
.line 72
.end local v0 # "current":Ljava/lang/Throwable;
.end local v2 # "update":Ljava/lang/Throwable;
:cond_25
goto :goto_0
.end method
.method public static flatten(Ljava/lang/Throwable;)Ljava/util/List;
.registers 8
.param p0, "t" # Ljava/lang/Throwable;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Throwable;",
")",
"Ljava/util/List<",
"Ljava/lang/Throwable;",
">;"
}
.end annotation
.line 89
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 90
.local v0, "list":Ljava/util/List;, "Ljava/util/List<Ljava/lang/Throwable;>;"
new-instance v1, Ljava/util/ArrayDeque;
invoke-direct {v1}, Ljava/util/ArrayDeque;-><init>()V
.line 91
.local v1, "deque":Ljava/util/ArrayDeque;, "Ljava/util/ArrayDeque<Ljava/lang/Throwable;>;"
invoke-virtual {v1, p0}, Ljava/util/ArrayDeque;->offer(Ljava/lang/Object;)Z
.line 93
:goto_d
invoke-virtual {v1}, Ljava/util/ArrayDeque;->isEmpty()Z
move-result v2
if-nez v2, :cond_3b
.line 94
invoke-virtual {v1}, Ljava/util/ArrayDeque;->removeFirst()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/Throwable;
.line 95
.local v2, "e":Ljava/lang/Throwable;
instance-of v3, v2, Lio/reactivex/exceptions/CompositeException;
if-eqz v3, :cond_37
.line 96
move-object v3, v2
check-cast v3, Lio/reactivex/exceptions/CompositeException;
.line 97
.local v3, "ce":Lio/reactivex/exceptions/CompositeException;
invoke-virtual {v3}, Lio/reactivex/exceptions/CompositeException;->getExceptions()Ljava/util/List;
move-result-object v4
.line 98
.local v4, "exceptions":Ljava/util/List;, "Ljava/util/List<Ljava/lang/Throwable;>;"
invoke-interface {v4}, Ljava/util/List;->size()I
move-result v5
add-int/lit8 v5, v5, -0x1
.local v5, "i":I
:goto_2a
if-ltz v5, :cond_36
.line 99
invoke-interface {v4, v5}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v6
invoke-virtual {v1, v6}, Ljava/util/ArrayDeque;->offerFirst(Ljava/lang/Object;)Z
.line 98
add-int/lit8 v5, v5, -0x1
goto :goto_2a
.line 101
.end local v3 # "ce":Lio/reactivex/exceptions/CompositeException;
.end local v4 # "exceptions":Ljava/util/List;, "Ljava/util/List<Ljava/lang/Throwable;>;"
.end local v5 # "i":I
:cond_36
goto :goto_3a
.line 102
:cond_37
invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 104
.end local v2 # "e":Ljava/lang/Throwable;
:goto_3a
goto :goto_d
.line 106
:cond_3b
return-object v0
.end method
.method public static terminate(Ljava/util/concurrent/atomic/AtomicReference;)Ljava/lang/Throwable;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/util/concurrent/atomic/AtomicReference<",
"Ljava/lang/Throwable;",
">;)",
"Ljava/lang/Throwable;"
}
.end annotation
.line 76
.local p0, "field":Ljava/util/concurrent/atomic/AtomicReference;, "Ljava/util/concurrent/atomic/AtomicReference<Ljava/lang/Throwable;>;"
invoke-virtual {p0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Throwable;
.line 77
.local v0, "current":Ljava/lang/Throwable;
sget-object v1, Lio/reactivex/internal/util/ExceptionHelper;->TERMINATED:Ljava/lang/Throwable;
if-eq v0, v1, :cond_11
.line 78
invoke-virtual {p0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
move-object v0, v1
check-cast v0, Ljava/lang/Throwable;
.line 80
:cond_11
return-object v0
.end method
.method public static throwIfThrowable(Ljava/lang/Throwable;)Ljava/lang/Exception;
.registers 2
.param p0, "e" # Ljava/lang/Throwable;
.annotation system Ldalvik/annotation/Signature;
value = {
"<E:",
"Ljava/lang/Throwable;",
">(",
"Ljava/lang/Throwable;",
")",
"Ljava/lang/Exception;",
"^TE;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Throwable;
}
.end annotation
.line 118
instance-of v0, p0, Ljava/lang/Exception;
if-eqz v0, :cond_8
.line 119
move-object v0, p0
check-cast v0, Ljava/lang/Exception;
return-object v0
.line 121
:cond_8
throw p0
.end method
.method public static wrapOrThrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
.registers 2
.param p0, "error" # Ljava/lang/Throwable;
.line 39
instance-of v0, p0, Ljava/lang/Error;
if-nez v0, :cond_12
.line 42
instance-of v0, p0, Ljava/lang/RuntimeException;
if-eqz v0, :cond_c
.line 43
move-object v0, p0
check-cast v0, Ljava/lang/RuntimeException;
return-object v0
.line 45
:cond_c
new-instance v0, Ljava/lang/RuntimeException;
invoke-direct {v0, p0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V
return-object v0
.line 40
:cond_12
move-object v0, p0
check-cast v0, Ljava/lang/Error;
throw v0
.end method