public void printStackTrace(PrintWriter output){
synchronized (output) {
    super.printStackTrace(output);
    Throwable throwable=getException();
    if (throwable != null) {
      output.print("Caused by: ");
      throwable.printStackTrace(output);
    }
  }
}

public void printStackTrace ( PrintWriter output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "Caused by: " ) ; throwable . printStackTrace ( output ) ; } } }
prints this exception ' s stack trace to the given print writer .
