Package VASSAL.tools
Class ThrowableUtils
java.lang.Object
VASSAL.tools.ThrowableUtils
public class ThrowableUtils extends Object
- Since:
- 3.1.0
- Author:
- Joel Uckelman
-
Method Summary
Modifier and Type Method Description static <T extends Throwable>
TgetAncestor(Class<T> cl, Throwable t)Returns the most recentThrowableof classTin the proper causal history of the givenThrowable, if one exists.static <T extends Throwable>
TgetRecent(Class<T> cl, Throwable t)Returns the most recentThrowableof classTin the (not necessarily proper) causal history of the givenThrowable, if one exists.static StringgetStackTrace(Throwable thrown)static <T extends Throwable>
voidthrowAncestor(Class<T> cl, Throwable t)Throws the most recentThrowableof classTin the proper causal history of the givenThrowable, if one exists.static <T extends Throwable>
voidthrowRecent(Class<T> cl, Throwable t)Throws the most recentThrowableof classTin the (not necessarily proper) causal history of the givenThrowable, if one exists.
-
Method Details
-
getAncestor
Returns the most recentThrowableof classTin the proper causal history of the givenThrowable, if one exists.- Parameters:
cl- theClassto search fort- theThrowableto check- Returns:
- the proper ancestor of class
T, ornullif none exists
-
getRecent
Returns the most recentThrowableof classTin the (not necessarily proper) causal history of the givenThrowable, if one exists. If the givenThrowableis of classT, it will be returned.- Parameters:
cl- theClassto search fort- theThrowableto check- Returns:
- the ancestor of class
T, ornullif none exists
-
throwAncestor
public static <T extends Throwable> void throwAncestor(Class<T> cl, Throwable t) throws T extends ThrowableThrows the most recentThrowableof classTin the proper causal history of the givenThrowable, if one exists.- Parameters:
cl- theClassto search fort- theThrowableto check- Throws:
T- if an ancestor of that class is found
-
throwRecent
public static <T extends Throwable> void throwRecent(Class<T> cl, Throwable t) throws T extends ThrowableThrows the most recentThrowableof classTin the (not necessarily proper) causal history of the givenThrowable, if one exists.- Parameters:
cl- theClassto search fort- theThrowableto check- Throws:
T- if an ancestor of that class is found
-
getStackTrace
- Parameters:
thrown- theThrowablewith the stack trace to convert- Returns:
- the stack trace as a
String
-