private TrimmingException(Throwable t, int toTrim) { // Trim the trace StackTraceElement[] trace = t.getStackTrace(); StackTraceElement[] trimmed = new StackTraceElement[trace.length - toTrim]; System.arraycopy(trace, 0, trimmed, 0, trimmed.length); setStackTrace(trimmed); // this.toString = t.toString(); this.source = t; // Recursively build the causes Throwable cause = t.getCause(); if (cause != null) { initCause(new TrimmingException(cause, toTrim)); } }
private TrimmingException(Throwable t, int toTrim) { // Trim the trace StackTraceElement[] trace = t.getStackTrace(); StackTraceElement[] trimmed = new StackTraceElement[trace.length - toTrim]; System.arraycopy(trace, 0, trimmed, 0, trimmed.length); setStackTrace(trimmed); // this.toString = t.toString(); this.source = t; // Recursively build the causes Throwable cause = t.getCause(); if (cause != null) { initCause(new TrimmingException(cause, toTrim)); } }