code: @Override
      public void printStackTrace(PrintWriter pw) {
          if ( getCause() != null ) {
              String superString = getLocalMessage();
              synchronized (pw) {
                  pw.print(superString);
                  pw.print((superString.endsWith(".") ?
                            " Caused by " : ". Caused by "));
                  getCause().printStackTrace( pw );
              }
          } else {
              super.printStackTrace( pw );
          }
      }
docs: Prints this exception's stack trace to a print writer.
  If this exception has a root exception; the stack trace of the
  root exception is printed to the print writer instead.
  @param pw The non-null print writer to which to print.