Package org.apache.tomcat.util
Class MultiThrowable
- java.lang.Object
-
- java.lang.Throwable
-
- org.apache.tomcat.util.MultiThrowable
-
- All Implemented Interfaces:
java.io.Serializable
public class MultiThrowable extends java.lang.ThrowableWraps 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.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MultiThrowable()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.Throwable t)Add a throwable to the list of wrapped throwables.java.lang.ThrowablegetThrowable()Return the wrapped throwable.java.util.List<java.lang.Throwable>getThrowables()Return a read-only list of the wrapped throwables.intsize()Return the number of throwables currently wrapped by this instance.java.lang.StringtoString()Overrides the default implementation to provide a concatenation of the messages associated with each of the wrapped throwables.
-
-
-
Method Detail
-
add
public void add(java.lang.Throwable t)
Add a throwable to the list of wrapped throwables.- Parameters:
t- The throwable to add
-
getThrowables
public java.util.List<java.lang.Throwable> getThrowables()
Return a read-only list of the wrapped throwables.- Returns:
- A read-only list of the wrapped throwables
-
getThrowable
public java.lang.Throwable getThrowable()
Return the wrapped throwable.- Returns:
nullif there are no wrapped throwables, the Throwable if there is a single wrapped throwable or the current instance if there are multiple wrapped throwables
-
size
public int size()
Return the number of throwables currently wrapped by this instance.- Returns:
- The number of throwables currently wrapped by this instance
-
toString
public java.lang.String 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.- Overrides:
toStringin classjava.lang.Throwable
-
-