Initial commit
This commit is contained in:
216
sources/io/reactivex/exceptions/CompositeException.java
Normal file
216
sources/io/reactivex/exceptions/CompositeException.java
Normal file
@@ -0,0 +1,216 @@
|
||||
package io.reactivex.exceptions;
|
||||
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class CompositeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 3026362227162912146L;
|
||||
private Throwable cause;
|
||||
private final List<Throwable> exceptions;
|
||||
private final String message;
|
||||
|
||||
static final class CompositeExceptionCausalChain extends RuntimeException {
|
||||
CompositeExceptionCausalChain() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
return "Chain of Causes for CompositeException In Order Received =>";
|
||||
}
|
||||
}
|
||||
|
||||
static abstract class PrintStreamOrWriter {
|
||||
PrintStreamOrWriter() {
|
||||
}
|
||||
|
||||
abstract void a(Object obj);
|
||||
}
|
||||
|
||||
static final class WrappedPrintStream extends PrintStreamOrWriter {
|
||||
private final PrintStream a;
|
||||
|
||||
WrappedPrintStream(PrintStream printStream) {
|
||||
this.a = printStream;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.exceptions.CompositeException.PrintStreamOrWriter
|
||||
void a(Object obj) {
|
||||
this.a.println(obj);
|
||||
}
|
||||
}
|
||||
|
||||
static final class WrappedPrintWriter extends PrintStreamOrWriter {
|
||||
private final PrintWriter a;
|
||||
|
||||
WrappedPrintWriter(PrintWriter printWriter) {
|
||||
this.a = printWriter;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.exceptions.CompositeException.PrintStreamOrWriter
|
||||
void a(Object obj) {
|
||||
this.a.println(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public CompositeException(Throwable... thArr) {
|
||||
this(thArr == null ? Collections.singletonList(new NullPointerException("exceptions was null")) : Arrays.asList(thArr));
|
||||
}
|
||||
|
||||
private void appendStackTrace(StringBuilder sb, Throwable th, String str) {
|
||||
sb.append(str);
|
||||
sb.append(th);
|
||||
sb.append('\n');
|
||||
for (StackTraceElement stackTraceElement : th.getStackTrace()) {
|
||||
sb.append("\t\tat ");
|
||||
sb.append(stackTraceElement);
|
||||
sb.append('\n');
|
||||
}
|
||||
if (th.getCause() != null) {
|
||||
sb.append("\tCaused by: ");
|
||||
appendStackTrace(sb, th.getCause(), "");
|
||||
}
|
||||
}
|
||||
|
||||
private List<Throwable> getListOfCauses(Throwable th) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Throwable cause = th.getCause();
|
||||
if (cause != null && cause != th) {
|
||||
while (true) {
|
||||
arrayList.add(cause);
|
||||
Throwable cause2 = cause.getCause();
|
||||
if (cause2 == null || cause2 == cause) {
|
||||
break;
|
||||
}
|
||||
cause = cause2;
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public synchronized Throwable getCause() {
|
||||
if (this.cause == null) {
|
||||
CompositeExceptionCausalChain compositeExceptionCausalChain = new CompositeExceptionCausalChain();
|
||||
HashSet hashSet = new HashSet();
|
||||
Iterator<Throwable> it = this.exceptions.iterator();
|
||||
Throwable th = compositeExceptionCausalChain;
|
||||
while (it.hasNext()) {
|
||||
Throwable next = it.next();
|
||||
if (!hashSet.contains(next)) {
|
||||
hashSet.add(next);
|
||||
for (Throwable th2 : getListOfCauses(next)) {
|
||||
if (hashSet.contains(th2)) {
|
||||
next = new RuntimeException("Duplicate found in causal chain so cropping to prevent loop ...");
|
||||
} else {
|
||||
hashSet.add(th2);
|
||||
}
|
||||
}
|
||||
try {
|
||||
th.initCause(next);
|
||||
} catch (Throwable unused) {
|
||||
}
|
||||
th = getRootCause(th);
|
||||
}
|
||||
}
|
||||
this.cause = compositeExceptionCausalChain;
|
||||
}
|
||||
return this.cause;
|
||||
}
|
||||
|
||||
public List<Throwable> getExceptions() {
|
||||
return this.exceptions;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
Throwable getRootCause(Throwable th) {
|
||||
Throwable cause = th.getCause();
|
||||
if (cause == null || this.cause == cause) {
|
||||
return th;
|
||||
}
|
||||
while (true) {
|
||||
Throwable cause2 = cause.getCause();
|
||||
if (cause2 == null || cause2 == cause) {
|
||||
break;
|
||||
}
|
||||
cause = cause2;
|
||||
}
|
||||
return cause;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public void printStackTrace() {
|
||||
printStackTrace(System.err);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.exceptions.size();
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public void printStackTrace(PrintStream printStream) {
|
||||
printStackTrace(new WrappedPrintStream(printStream));
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public void printStackTrace(PrintWriter printWriter) {
|
||||
printStackTrace(new WrappedPrintWriter(printWriter));
|
||||
}
|
||||
|
||||
public CompositeException(Iterable<? extends Throwable> iterable) {
|
||||
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (iterable != null) {
|
||||
for (Throwable th : iterable) {
|
||||
if (th instanceof CompositeException) {
|
||||
linkedHashSet.addAll(((CompositeException) th).getExceptions());
|
||||
} else if (th != null) {
|
||||
linkedHashSet.add(th);
|
||||
} else {
|
||||
linkedHashSet.add(new NullPointerException("Throwable was null!"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
linkedHashSet.add(new NullPointerException("errors was null"));
|
||||
}
|
||||
if (!linkedHashSet.isEmpty()) {
|
||||
arrayList.addAll(linkedHashSet);
|
||||
this.exceptions = Collections.unmodifiableList(arrayList);
|
||||
this.message = this.exceptions.size() + " exceptions occurred. ";
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("errors is empty");
|
||||
}
|
||||
|
||||
private void printStackTrace(PrintStreamOrWriter printStreamOrWriter) {
|
||||
StringBuilder sb = new StringBuilder(PeripheralType.SERVO);
|
||||
sb.append(this);
|
||||
sb.append('\n');
|
||||
for (StackTraceElement stackTraceElement : getStackTrace()) {
|
||||
sb.append("\tat ");
|
||||
sb.append(stackTraceElement);
|
||||
sb.append('\n');
|
||||
}
|
||||
int i = 1;
|
||||
for (Throwable th : this.exceptions) {
|
||||
sb.append(" ComposedException ");
|
||||
sb.append(i);
|
||||
sb.append(" :\n");
|
||||
appendStackTrace(sb, th, "\t");
|
||||
i++;
|
||||
}
|
||||
printStreamOrWriter.a(sb.toString());
|
||||
}
|
||||
}
|
22
sources/io/reactivex/exceptions/Exceptions.java
Normal file
22
sources/io/reactivex/exceptions/Exceptions.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package io.reactivex.exceptions;
|
||||
|
||||
import io.reactivex.internal.util.ExceptionHelper;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class Exceptions {
|
||||
public static RuntimeException a(Throwable th) {
|
||||
throw ExceptionHelper.a(th);
|
||||
}
|
||||
|
||||
public static void b(Throwable th) {
|
||||
if (th instanceof VirtualMachineError) {
|
||||
throw ((VirtualMachineError) th);
|
||||
}
|
||||
if (th instanceof ThreadDeath) {
|
||||
throw ((ThreadDeath) th);
|
||||
}
|
||||
if (th instanceof LinkageError) {
|
||||
throw ((LinkageError) th);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package io.reactivex.exceptions;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class MissingBackpressureException extends RuntimeException {
|
||||
private static final long serialVersionUID = 8517344746016032542L;
|
||||
|
||||
public MissingBackpressureException() {
|
||||
}
|
||||
|
||||
public MissingBackpressureException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package io.reactivex.exceptions;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class OnErrorNotImplementedException extends RuntimeException {
|
||||
private static final long serialVersionUID = -6298857009889503852L;
|
||||
|
||||
public OnErrorNotImplementedException(String str, Throwable th) {
|
||||
super(str, th == null ? new NullPointerException() : th);
|
||||
}
|
||||
|
||||
/* JADX WARN: Illegal instructions before constructor call */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public OnErrorNotImplementedException(java.lang.Throwable r3) {
|
||||
/*
|
||||
r2 = this;
|
||||
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
||||
r0.<init>()
|
||||
java.lang.String r1 = "The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | "
|
||||
r0.append(r1)
|
||||
if (r3 == 0) goto L11
|
||||
java.lang.String r1 = r3.getMessage()
|
||||
goto L13
|
||||
L11:
|
||||
java.lang.String r1 = ""
|
||||
L13:
|
||||
r0.append(r1)
|
||||
java.lang.String r0 = r0.toString()
|
||||
r2.<init>(r0, r3)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: io.reactivex.exceptions.OnErrorNotImplementedException.<init>(java.lang.Throwable):void");
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package io.reactivex.exceptions;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class ProtocolViolationException extends IllegalStateException {
|
||||
private static final long serialVersionUID = 1644750035281290266L;
|
||||
|
||||
public ProtocolViolationException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
10
sources/io/reactivex/exceptions/UndeliverableException.java
Normal file
10
sources/io/reactivex/exceptions/UndeliverableException.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package io.reactivex.exceptions;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class UndeliverableException extends IllegalStateException {
|
||||
private static final long serialVersionUID = 1644750035281290266L;
|
||||
|
||||
public UndeliverableException(Throwable th) {
|
||||
super("The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | " + th.getMessage(), th);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user