@Override public void printStackTrace(PrintStream s){
  if (s != null) {
    super.printStackTrace(s);
    SQLException next=getNextException();
    for (int i=0; i < 100 && next != null; i++) {
      s.println(next.toString());
      next=next.getNextException();
    }
    if (next != null) {
      s.println("(truncated)");
    }
  }
}

@ Override public void printStackTrace ( PrintStream s ) { if ( s != null ) { super . printStackTrace ( s ) ; SQLException next = getNextException ( ) ; for ( int i = 0 ; i < 100 && next != null ; i ++ ) { s . println ( next . toString ( ) ) ; next = next . getNextException ( ) ; } if ( next != null ) { s . println ( "(truncated)" ) ; } } }
prints the stack trace to the specified print stream .
