public static void clearStackTraces(Throwable t){
  StackTraceElement[] empty=new StackTraceElement[0];
  while (t != null) {
    t.setStackTrace(empty);
    t=t.getCause();
  }
}

public static void clearStackTraces ( Throwable t ) { StackTraceElement [ ] empty = new StackTraceElement [ 0 ] ; while ( t != null ) { t . setStackTrace ( empty ) ; t = t . getCause ( ) ; } }
clear the stack trace of the given throwable by replacing it with an empty stacktraceelement array , and do the same for all of its chained causative exceptions .
