Introspects the Throwable to obtain the cause.
The method searches for methods with specific names that return a Throwable object.
return getCause(throwable, CAUSE_METHOD_NAMES);
if (throwable instanceof SQLException) { return ((SQLException) throwable).getNextException(); } else if (throwable instanceof InvocationTargetException) { return ((InvocationTargetException) throwable).getTargetException(); } else { return null;
Finds a Throwable for known types.
Uses instanceof checks to examine the exception, looking for well known types which could contain chained or wrapped exceptions.
if (throwable instanceof SQLException) { return ((SQLException) throwable).getNextException(); } else if (throwable instanceof InvocationTargetException) { return ((InvocationTargetException) throwable).getTargetException(); } else { return null;
if (exception instanceof SQLException) { return ((SQLException) exception).getNextException(); } else if (exception instanceof InvocationTargetException) { return ((InvocationTargetException) exception).getTargetException(); } else { return null;
StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); Throwable[] ts = getThrowables(t); for (Throwable t1 : ts) { t1.printStackTrace(pw); if (isNestedThrowable(t1)) { break; return sw.getBuffer().toString();
Walks through the exception chain to the last element -- the "root" of the tree -- using #getCause(Throwable) , and returns that exception.
Throwable cause = getCause(throwable); if (cause != null) { throwable = cause; while ((throwable = getCause(throwable)) != null) { cause = throwable; return cause; ...
Throwable[] throwables = getThrowables(t); int count = throwables.length; ArrayList<String> frames = new ArrayList<String>(); List<String> nextTrace = getStackFrameList(throwables[count - 1]); for (int i = count; --i >= 0;) { List<String> trace = nextTrace; if (i != 0) { nextTrace = getStackFrameList(throwables[i - 1]); ...
Creates a compact stack trace for the root cause of the supplied Throwable.
if (throwable == null) { return new String[0]; Throwable throwables[] = getThrowables(throwable); int count = throwables.length; ArrayList frames = new ArrayList(); List nextTrace = getStackFrameList(throwables[count - 1]); for (int i = count; --i >= 0;) { ...