public class Util extends Object
Msg or Awt, or Swing.
| Modifier and Type | Class and Description |
|---|---|
static class |
Util.InfiniteExceptionChain
This exception indicates, that there is probably a cycle in an exception chain.
|
| Modifier and Type | Field and Description |
|---|---|
static char |
causeIndenter
The char used to indent one level of causal chain when reporting the messages or stack trace of an exception chain.
|
static Util.InfiniteExceptionChain |
INFINITE_EXCEPTION_CHAIN
Reusable instance
|
static String |
lineSeparator
Returns the line separator for the actual platform.
|
static String |
wasCausing
The string used to delimit the stack trace part of a causing exception from
the following stack trace of the caused exception.
|
| Modifier and Type | Method and Description |
|---|---|
static Object[] |
clone(Object[] i_array)
Returns a new copy of the array or null, if null was provided
|
static Throwable |
getCause(Throwable i_throwable)
Returns the direct cause of i_throwable.
|
static Throwable[] |
getCauses(Throwable i_throwable)
Result: The directly causing Throwables of i_throwable,
if there are some, otherwise null.
|
static Throwable |
getContainedException(Throwable i_throwableChain,
Class<? extends Throwable> i_expectedThrowableClass)
Returns the upmost exception in i_throwableChain, which is of class
i_expectedThrowableClass, helpwise null.
|
static int |
getMaxRecursionDepth()
Gets the maximum recursion depth as specified in method
setMaxRecursionDepth(int). |
static Throwable |
getOriginalException(Throwable i_throwable) |
static void |
setCauseGetter(CauseGetter i_causeGetter)
Sets a CauseGetter to be used by method
getCause(Throwable)
in order to get the cause of a Throwable object. |
static void |
setMaxRecursionDepth(int maxRecursionDepth)
Sets the maximum depth to follow an exception chain, when calling recursively method
getCause(Throwable). |
static String |
toString(Throwable i_throwable)
For low level reporting of an exception.
|
public static final Util.InfiniteExceptionChain INFINITE_EXCEPTION_CHAIN
public static final String lineSeparator
public static final String wasCausing
public static final char causeIndenter
public static Object[] clone(Object[] i_array)
i_array - The array to clonepublic static final void setCauseGetter(CauseGetter i_causeGetter)
getCause(Throwable)
in order to get the cause of a Throwable object.
Default is ReflectionCauseGetteri_causeGetter - A CauseGetter to be used in the futurepublic static final Throwable[] getCauses(Throwable i_throwable)
ReflectionCauseGetter
by default. You can replace the cause getter by method setCauseGetter(multex.CauseGetter).
The cause getter is used only for getting a cause, which is returned by
a method of the Throwable. All MulTEx parameters of this Throwable, which are themselves
instances of Throwable, are returned, too.i_throwable - The root of a Throwable treepublic static final int getMaxRecursionDepth()
setMaxRecursionDepth(int).public static void setMaxRecursionDepth(int maxRecursionDepth)
throws IllegalArgumentException
getCause(Throwable).
Will be used by _appendCompactStackTraceRecursively(StringBuffer, Throwable, StackTraceElement[], int),
MsgText._appendMessageTreeRecursively(StringBuffer, Throwable, java.util.ResourceBundle, String, int)
and should be respected by everyone following an exception chain by calling method getCause(Throwable).maxRecursionDepth - May range from 5 to 100. Default is 10.IllegalArgumentException - argument outside of range 5...100public static final Throwable getCause(Throwable i_throwable)
i_throwable - The Throwable which may begin a chain of Throwables.ReflectionCauseGetter
by default. You can replace the cause getter by method setCauseGetter(multex.CauseGetter).
Tries to avoid a cause cycle by returning null, if a direct cycle is detected.public static Throwable getContainedException(Throwable i_throwableChain, Class<? extends Throwable> i_expectedThrowableClass)
i_throwableChain - a chain of Throwablesi_expectedThrowableClass - the class an instance of which we searchINFINITE_EXCEPTION_CHAIN if the exception chain to be followed is longer than getMaxRecursionDepth().setMaxRecursionDepth(int)public static final Throwable getOriginalException(Throwable i_throwable)
i_throwable - A Throwable chain.INFINITE_EXCEPTION_CHAIN if the exception chain to be followed is longer than getMaxRecursionDepth().getCause(Throwable),
setMaxRecursionDepth(int)public static String toString(Throwable i_throwable)
MultexException, too.
But some legacy exceptions suppress the class name or the message of the exception. In order to obtain all relevant information of an exception we use our own toString(), which augments the result of .toString() by the class name and the message of the exception, if needed.
i_throwable - The Throwable which is to be converted to a StringCopyright © 1998–2022 Berliner Hochschule für Technik - Berlin University of Applied Sciences and Technology. All rights reserved.