public static String formatException(Exception exc){
  StringWriter stringWriter=new StringWriter();
  PrintWriter printWriter=new PrintWriter(stringWriter);
  exc.printStackTrace(printWriter);
  try {
    stringWriter.close();
  }
 catch (  IOException ex) {
  }
  return stringWriter.toString();
}

public static String formatException ( Exception exc ) { StringWriter stringWriter = new StringWriter ( ) ; PrintWriter printWriter = new PrintWriter ( stringWriter ) ; exc . printStackTrace ( printWriter ) ; try { stringWriter . close ( ) ; } catch ( IOException ex ) { } return stringWriter . toString ( ) ; }
format the exception into a string that can be displayed .
