public void printStackTrace(PrintStream ps, String pfx, String cap) { ps.println(pfx + cap + this); StackTraceElement[] trace = super.getStackTrace(); for (StackTraceElement traceElement : trace) { ps.println(pfx + "\tat " + traceElement); } // Print suppressed exceptions, if any for (Throwable se : suppressed) { printThrowable(se, ps, pfx + "\t", "Suppressed: "); } // Print cause, if any Throwable ourCause = getCause(); if (ourCause != null && (!hasSuppressed || ourCause != suppressed.get(0))) { printThrowable(ourCause, ps, pfx + "\t", "Caused by: "); } } private void printThrowable(Throwable t, PrintStream ps, String pfx, String cap) {
public void printStackTrace(PrintStream ps, String pfx, String cap) { ps.println(pfx + cap + this); StackTraceElement[] trace = super.getStackTrace(); for (StackTraceElement traceElement : trace) { ps.println(pfx + "\tat " + traceElement); } // Print suppressed exceptions, if any for (Throwable se : suppressed) { printThrowable(se, ps, pfx + "\t", "Suppressed: "); } // Print cause, if any Throwable ourCause = getCause(); if (ourCause != null && (!hasSuppressed || ourCause != suppressed.get(0))) { printThrowable(ourCause, ps, pfx + "\t", "Caused by: "); } } private void printThrowable(Throwable t, PrintStream ps, String pfx, String cap) {
private void printThrowable(Throwable t, PrintStream ps, String pfx, String cap) { if (t instanceof ToolException) { ((ToolException)t).printStackTrace(ps, pfx, cap); } else { ps.println(pfx + cap + t); StackTraceElement[] trace = t.getStackTrace(); for (StackTraceElement ste : trace) { ps.println(pfx + "\tat " + ste); } if (t.getCause() != null) { printThrowable(t.getCause(), ps, pfx + "\t", "Caused by: "); } } }
private void printThrowable(Throwable t, PrintStream ps, String pfx, String cap) { if (t instanceof ToolException) { ((ToolException)t).printStackTrace(ps, pfx, cap); } else { ps.println(pfx + cap + t); StackTraceElement[] trace = t.getStackTrace(); for (StackTraceElement ste : trace) { ps.println(pfx + "\tat " + ste); } if (t.getCause() != null) { printThrowable(t.getCause(), ps, pfx + "\t", "Caused by: "); } } }