Here you can find the source of fmtError( Exception e )
protected static String fmtError( Exception e )
//package com.java2s; import java.io.*; public class Main { protected static String fmtError(Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try {/*from w w w . j ava 2 s.c o m*/ e.printStackTrace(pw); pw.flush(); } finally { pw.close(); } sw.flush(); return e.getMessage() + "\n" + sw.toString(); } }