01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.util.exception;
06:
07: import java.io.PrintStream;
08:
09: public final class ExceptionUtil {
10:
11: /**
12: * Does no filtering of duplicate stacks or causes like {@link Throwable#printStackTrace(PrintStream)} does, just
13: * prints out the entire stack trace.
14: */
15: public static void dumpFullStackTrace(final Throwable exception,
16: final PrintStream outputStream) {
17: outputStream.println(exception.toString());
18: final StackTraceElement[] stack = exception.getStackTrace();
19: for (int pos = 0; pos < stack.length; ++pos) {
20: outputStream.println("\tat " + stack[pos]);
21: }
22: final Throwable cause = exception.getCause();
23: if (cause != null && cause != exception) {
24: outputStream.print("Caused by: ");
25: dumpFullStackTrace(cause, outputStream);
26: }
27: }
28:
29: }
|