public class NestedException extends RuntimeException
Modifier and Type | Field and Description |
---|---|
static int |
STACKTRACE_LENGTH
Deprecated.
|
Constructor and Description |
---|
NestedException()
Deprecated.
Constructor for NestedException.
|
NestedException(String arg0)
Deprecated.
Constructor for NestedException.
|
NestedException(String msg,
Throwable cause)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Throwable |
getCausingException()
Deprecated.
|
Throwable |
getExceptionRoot()
Deprecated.
depth=0 if the CausingException is not a NestedException, otherwise the number of nestings
public int getNestingDepth() {
Throwable t=getCausingException(); // depth=0
int depth=0;
while (t instanceof NestedException) {
t=((NestedException)t).getCausingException();
depth++;
}
return depth;
}
public Throwable getCausingException(int depth) {
return getCausingException(depth, this);
}
private Throwable getCausingException(int depth, NestedException ne) {
Throwable t=ne.getCausingException();
if (depth<=0) return t;
else if (t instanceof NestedException) {
return getCausingException(--depth, (NestedException)t);
} else {
throw new IllegalArgumentException("Reached bottom of nesting at depth=" + depth);
}
}
/** returns the exception at the bottom of the nestings
|
List |
getNestedExceptions()
Deprecated.
returns a list containing the exceptions on all nesting levels
|
static String |
getStacktrace(Throwable t,
int depth)
Deprecated.
|
String |
toString()
Deprecated.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public NestedException()
public NestedException(String arg0)
arg0
- public Throwable getCausingException()
public Throwable getExceptionRoot()
public List getNestedExceptions()
© 1998- 2021 Escenic AS