jimu-decompiled/sources/io/reactivex/internal/util/ExceptionHelper.java
2025-05-13 19:24:51 +02:00

45 lines
1.3 KiB
Java

package io.reactivex.internal.util;
import io.reactivex.exceptions.CompositeException;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes2.dex */
public final class ExceptionHelper {
public static final Throwable a = new Termination();
static final class Termination extends Throwable {
Termination() {
super("No further exceptions");
}
@Override // java.lang.Throwable
public Throwable fillInStackTrace() {
return this;
}
}
public static RuntimeException a(Throwable th) {
if (th instanceof Error) {
throw ((Error) th);
}
return th instanceof RuntimeException ? (RuntimeException) th : new RuntimeException(th);
}
public static <T> boolean a(AtomicReference<Throwable> atomicReference, Throwable th) {
Throwable th2;
do {
th2 = atomicReference.get();
if (th2 == a) {
return false;
}
} while (!atomicReference.compareAndSet(th2, th2 == null ? th : new CompositeException(th2, th)));
return true;
}
public static <T> Throwable a(AtomicReference<Throwable> atomicReference) {
Throwable th = atomicReference.get();
Throwable th2 = a;
return th != th2 ? atomicReference.getAndSet(th2) : th;
}
}