String (Throwable tr) { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); tr.printStackTrace(writer); StringBuffer buffer = stringWriter.getBuffer(); return buffer.toString(); }