Top Description Fields Constructors Methods
org.apache.tomcat.util

public Class MultiThrowable

extends Throwable
Class Inheritance
Imports
java.util.ArrayList, .Collections, .List

Wraps a list of throwables as a single throwable. This is intended to be used when multiple actions are taken where each may throw an exception but all actions are taken before any errors are reported.

This class is NOT threadsafe.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(Throwable
The throwable to add
t
)

Add a throwable to the list of wrapped throwables.

public Throwable

Returns:

null if there are no wrapped throwables, the Throwable if there is a single wrapped throwable or the current instance of there are multiple wrapped throwables
getThrowable
()

public List<Throwable>

Returns:

A read-only list of the wrapped throwables.
getThrowables
()

public int

Returns:

The number of throwables currently wrapped by this instance.
size
()

public String
toString()

Overrides java.lang.Throwable.toString.

Overrides the default implementation to provide a concatenation of the messages associated with each of the wrapped throwables.

Inherited from java.lang.Throwable:
addSuppressedfillInStackTracegetCausegetLocalizedMessagegetMessagegetStackTracegetSuppressedinitCauseprintStackTraceprintStackTraceprintStackTracesetStackTrace

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Throwable.serialVersionUID.

throwablesback to summary
private List<Throwable> throwables

Constructor Detail

MultiThrowableback to summary
public MultiThrowable()

Method Detail

addback to summary
public void add(Throwable t)

Add a throwable to the list of wrapped throwables.

Parameters
t:Throwable

The throwable to add

getThrowableback to summary
public Throwable getThrowable()
Returns:Throwable

null if there are no wrapped throwables, the Throwable if there is a single wrapped throwable or the current instance of there are multiple wrapped throwables

getThrowablesback to summary
public List<Throwable> getThrowables()
Returns:List<Throwable>

A read-only list of the wrapped throwables.

sizeback to summary
public int size()
Returns:int

The number of throwables currently wrapped by this instance.

toStringback to summary
public String toString()

Overrides java.lang.Throwable.toString.

Overrides the default implementation to provide a concatenation of the messages associated with each of the wrapped throwables. Note that the format of the returned String is not guaranteed to be fixed and may change in a future release.

Returns:String

Doc from java.lang.Throwable.toString.

a string representation of this throwable.

Annotations
@Override