Top Description Inners Fields Constructors Methods
io.reactivex.rxjava3.exceptions

public final Class CompositeException

extends RuntimeException
Class Inheritance
Imports
java.io.*, java.util.*, io.reactivex.rxjava3.annotations.NonNull

Represents an exception that is a composite of one or more other exceptions. A CompositeException does not modify the structure of any exception it wraps, but at print-time it iterates through the list of Throwables contained in the composite in order to print them all. Its invariant is to contain an immutable, ordered (by insertion order), unique list of non-composite exceptions. You can retrieve individual exceptions in this list with getExceptions(). The printStackTrace() implementation handles the StackTrace in a customized way instead of using getCause() so that it can avoid circular references. If you invoke getCause(), it will lazily create the causal chain but will stop if it finds any Throwable in the chain that it has already seen.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
CompositeException.ExceptionOverview

Contains a formatted message with a simplified representation of the exception graph contained within the CompositeException.

pack-priv abstract static class
pack-priv static class
CompositeException.WrappedPrintStream

Same abstraction and implementation as in JDK to allow PrintStream and PrintWriter to share implementation.

pack-priv static class
CompositeException.WrappedPrintWriter

Same abstraction and implementation as in JDK to allow PrintStream and PrintWriter to share implementation.

Field Summary

Modifier and TypeField and Description
private Throwable
private final List<Throwable>
private final String
private static final long

Constructor Summary

AccessConstructor and Description
public
CompositeException(@NonNull Throwable...
the Throwables to have as initially suppressed exceptions
exceptions
)

Constructs a CompositeException with the given array of Throwables as the list of suppressed exceptions.

public
CompositeException(@NonNull Iterable<? extends Throwable>
the Throwables to have as initially suppressed exceptions
errors
)

Constructs a CompositeException with the given array of Throwables as the list of suppressed exceptions.

Method Summary

Modifier and TypeMethod and Description
private void
public synchronized @NonNull Throwable
getCause()

Overrides java.lang.Throwable.getCause.

Returns the cause of this throwable or null if the cause is nonexistent or unknown.
public @NonNull List<Throwable>

Returns:

the exceptions that make up the CompositeException, as a List of Throwables
getExceptions
()

Retrieves the list of exceptions that make up the CompositeException.

public @NonNull String
getMessage()

Overrides java.lang.Throwable.getMessage.

Returns the detail message string of this throwable.
public void
printStackTrace()

Overrides java.lang.Throwable.printStackTrace.

All of the following printStackTrace functionality is derived from JDK Throwable printStackTrace.
public void
printStackTrace(PrintStream
PrintStream to use for output
s
)

Overrides java.lang.Throwable.printStackTrace.

Prints this throwable and its backtrace to the specified print stream.
public void
printStackTrace(PrintWriter
PrintWriter to use for output
s
)

Overrides java.lang.Throwable.printStackTrace.

Prints this throwable and its backtrace to the specified print writer.
private void
printStackTrace(CompositeException.PrintStreamOrWriter
stream to print to
output
)

Special handling for printing out a CompositeException.

public int

Returns:

the number of suppressed exceptions
size
()

Returns the number of suppressed exceptions.

Field Detail

causeback to summary
private Throwable cause

Hides java.lang.Throwable.cause.

exceptionsback to summary
private final List<Throwable> exceptions
messageback to summary
private final String message
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

CompositeExceptionback to summary
public CompositeException(@NonNull Throwable... exceptions)

Constructs a CompositeException with the given array of Throwables as the list of suppressed exceptions.

Parameters
exceptions:@NonNull Throwable[]

the Throwables to have as initially suppressed exceptions

Exceptions
IllegalArgumentException:
if exceptions is empty.
CompositeExceptionback to summary
public CompositeException(@NonNull Iterable<? extends Throwable> errors)

Constructs a CompositeException with the given array of Throwables as the list of suppressed exceptions.

Parameters
errors:@NonNull Iterable<? extends Throwable>

the Throwables to have as initially suppressed exceptions

Exceptions
IllegalArgumentException:
if errors is empty.

Method Detail

appendStackTraceback to summary
private void appendStackTrace(CompositeException.PrintStreamOrWriter output, Throwable ex, String prefix)
getCauseback to summary
public synchronized @NonNull Throwable getCause()

Overrides java.lang.Throwable.getCause.

Doc from java.lang.Throwable.getCause.

Returns the cause of this throwable or null if the cause is nonexistent or unknown. (The cause is the throwable that caused this throwable to get thrown.)

This implementation returns the cause that was supplied via one of the constructors requiring a Throwable, or that was set after creation with the initCause(Throwable) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means. This is appropriate for a "legacy chained throwable" that predates the addition of chained exceptions to Throwable. Note that it is not necessary to override any of the PrintStackTrace methods, all of which invoke the getCause method to determine the cause of a throwable.

Returns:@NonNull Throwable

the cause of this throwable or null if the cause is nonexistent or unknown.

Annotations
@Override
@NonNull
getExceptionsback to summary
public @NonNull List<Throwable> getExceptions()

Retrieves the list of exceptions that make up the CompositeException.

Returns:@NonNull List<Throwable>

the exceptions that make up the CompositeException, as a List of Throwables

Annotations
@NonNull
getMessageback to summary
public @NonNull String getMessage()

Overrides java.lang.Throwable.getMessage.

Doc from java.lang.Throwable.getMessage.

Returns the detail message string of this throwable.

Returns:@NonNull String

the detail message string of this Throwable instance (which may be null).

Annotations
@Override
@NonNull
printStackTraceback to summary
public void printStackTrace()

Overrides java.lang.Throwable.printStackTrace.

All of the following printStackTrace functionality is derived from JDK Throwable printStackTrace. In particular, the PrintStreamOrWriter abstraction is copied wholesale. Changes from the official JDK implementation:

  • no infinite loop detection
  • smaller critical section holding PrintStream lock
  • explicit knowledge about the exceptions List that this loops through
Annotations
@Override
printStackTraceback to summary
public void printStackTrace(PrintStream s)

Overrides java.lang.Throwable.printStackTrace.

Doc from java.lang.Throwable.printStackTrace.

Prints this throwable and its backtrace to the specified print stream.

Parameters
s:PrintStream

PrintStream to use for output

Annotations
@Override
printStackTraceback to summary
public void printStackTrace(PrintWriter s)

Overrides java.lang.Throwable.printStackTrace.

Doc from java.lang.Throwable.printStackTrace.

Prints this throwable and its backtrace to the specified print writer.

Parameters
s:PrintWriter

PrintWriter to use for output

Annotations
@Override
printStackTraceback to summary
private void printStackTrace(CompositeException.PrintStreamOrWriter output)

Special handling for printing out a CompositeException. Loops through all inner exceptions and prints them out.

Parameters
output:CompositeException.PrintStreamOrWriter

stream to print to

sizeback to summary
public int size()

Returns the number of suppressed exceptions.

Returns:int

the number of suppressed exceptions

io.reactivex.rxjava3.exceptions back to summary

pack-priv final Class CompositeException.ExceptionOverview

extends RuntimeException
Class Inheritance

Contains a formatted message with a simplified representation of the exception graph contained within the CompositeException.

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 synchronized Throwable
fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

ExceptionOverviewback to summary
pack-priv ExceptionOverview(String message)

Method Detail

fillInStackTraceback to summary
public synchronized 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
io.reactivex.rxjava3.exceptions back to summary

pack-priv abstract Class CompositeException.PrintStreamOrWriter

extends Object
Class Inheritance
  • java.lang.Object
  • io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter
Known Direct Subclasses
io.reactivex.rxjava3.exceptions.CompositeException.WrappedPrintStream, io.reactivex.rxjava3.exceptions.CompositeException.WrappedPrintWriter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract CompositeException.PrintStreamOrWriter

Returns:

this
append
(Object
the object to print
o
)

Prints the object's string representation via the underlying PrintStream or PrintWriter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PrintStreamOrWriterback to summary
pack-priv PrintStreamOrWriter()

Method Detail

appendback to summary
pack-priv abstract CompositeException.PrintStreamOrWriter append(Object o)

Prints the object's string representation via the underlying PrintStream or PrintWriter.

Parameters
o:Object

the object to print

Returns:CompositeException.PrintStreamOrWriter

this

io.reactivex.rxjava3.exceptions back to summary

pack-priv final Class CompositeException.WrappedPrintStream

extends PrintStreamOrWriter
Class Inheritance

Same abstraction and implementation as in JDK to allow PrintStream and PrintWriter to share implementation.

Field Summary

Modifier and TypeField and Description
private final PrintStream

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv CompositeException.WrappedPrintStream
append(Object
the object to print
o
)

Implements abstract io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter.append.

Prints the object's string representation via the underlying PrintStream or PrintWriter.

Field Detail

printStreamback to summary
private final PrintStream printStream

Constructor Detail

WrappedPrintStreamback to summary
pack-priv WrappedPrintStream(PrintStream printStream)

Method Detail

appendback to summary
pack-priv CompositeException.WrappedPrintStream append(Object o)

Implements abstract io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter.append.

Doc from io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter.append.

Prints the object's string representation via the underlying PrintStream or PrintWriter.

Parameters
o:Object

the object to print

Returns:CompositeException.WrappedPrintStream

this

Annotations
@Override
io.reactivex.rxjava3.exceptions back to summary

pack-priv final Class CompositeException.WrappedPrintWriter

extends PrintStreamOrWriter
Class Inheritance

Same abstraction and implementation as in JDK to allow PrintStream and PrintWriter to share implementation.

Field Summary

Modifier and TypeField and Description
private final PrintWriter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv CompositeException.WrappedPrintWriter
append(Object
the object to print
o
)

Implements abstract io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter.append.

Prints the object's string representation via the underlying PrintStream or PrintWriter.

Field Detail

printWriterback to summary
private final PrintWriter printWriter

Constructor Detail

WrappedPrintWriterback to summary
pack-priv WrappedPrintWriter(PrintWriter printWriter)

Method Detail

appendback to summary
pack-priv CompositeException.WrappedPrintWriter append(Object o)

Implements abstract io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter.append.

Doc from io.reactivex.rxjava3.exceptions.CompositeException.PrintStreamOrWriter.append.

Prints the object's string representation via the underlying PrintStream or PrintWriter.

Parameters
o:Object

the object to print

Returns:CompositeException.WrappedPrintWriter

this

Annotations
@Override