Top Description Inners Fields Constructors Methods
io.reactivex.internal.util

public final Class ExceptionHelper

extends Object
Class Inheritance
Imports
java.util.*, java.util.concurrent.TimeUnit, java.util.concurrent.atomic.AtomicReference, io.reactivex.exceptions.CompositeException

Terminal atomics for Throwable containers.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
public static final Throwable
TERMINATED

A singleton instance of a Throwable indicating a terminal state for exceptions, don't leak this.

Constructor Summary

AccessConstructor and Description
private
ExceptionHelper()

Utility class.

Method Summary

Modifier and TypeMethod and Description
public static <T> boolean
public static List<Throwable>

Returns:

the list of Throwables flattened in a depth-first manner
flatten
(Throwable
the starting throwable
t
)

Returns a flattened list of Throwables from tree-like CompositeException chain.

public static <T> Throwable
public static <
the generic exception type
E extends Throwable
>
Exception

Returns:

the Throwable e if it is a subclass of Exception
throwIfThrowable
(Throwable
the Throwable error to return or throw
e
)

Workaround for Java 6 not supporting throwing a final Throwable from a catch block.

public static String
timeoutMessage(long timeout, TimeUnit unit)

public static RuntimeException

Returns:

the (wrapped) error
wrapOrThrow
(Throwable
the error to wrap or throw
error
)

If the provided Throwable is an Error this method throws it, otherwise returns a RuntimeException wrapping the error if that error is a checked exception.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

TERMINATEDback to summary
public static final Throwable TERMINATED

A singleton instance of a Throwable indicating a terminal state for exceptions, don't leak this.

Constructor Detail

ExceptionHelperback to summary
private ExceptionHelper()

Utility class.

Method Detail

addThrowableback to summary
public static <T> boolean addThrowable(AtomicReference<Throwable> field, Throwable exception)
flattenback to summary
public static List<Throwable> flatten(Throwable t)

Returns a flattened list of Throwables from tree-like CompositeException chain.

Parameters
t:Throwable

the starting throwable

Returns:List<Throwable>

the list of Throwables flattened in a depth-first manner

terminateback to summary
public static <T> Throwable terminate(AtomicReference<Throwable> field)
throwIfThrowableback to summary
public static <E extends Throwable> Exception throwIfThrowable(Throwable e) throws Throwable-:E

Workaround for Java 6 not supporting throwing a final Throwable from a catch block.

Parameters
<E>
the generic exception type
e:Throwable

the Throwable error to return or throw

Returns:Exception

the Throwable e if it is a subclass of Exception

Annotations
@SuppressWarnings:unchecked
Exceptions
Throwable-:E:
the generic exception thrown
timeoutMessageback to summary
public static String timeoutMessage(long timeout, TimeUnit unit)
wrapOrThrowback to summary
public static RuntimeException wrapOrThrow(Throwable error)

If the provided Throwable is an Error this method throws it, otherwise returns a RuntimeException wrapping the error if that error is a checked exception.

Parameters
error:Throwable

the error to wrap or throw

Returns:RuntimeException

the (wrapped) error

io.reactivex.internal.util back to summary

pack-priv final Class ExceptionHelper.Termination

extends Throwable
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Throwable
fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace.
Inherited from java.lang.Throwable:
addSuppressedgetCausegetLocalizedMessagegetMessagegetStackTracegetSuppressedinitCauseprintStackTraceprintStackTraceprintStackTracesetStackTracetoString

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Throwable.serialVersionUID.

Constructor Detail

Terminationback to summary
pack-priv Termination()

Method Detail

fillInStackTraceback to summary
public Throwable fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Doc from java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace. This method records within this Throwable object information about the current state of the stack frames for the current thread.

If the stack trace of this Throwable is not writable, calling this method has no effect.

Returns:Throwable

a reference to this Throwable instance.

Annotations
@Override