Here you can find the source of stringify(Throwable t)
public static String stringify(Throwable t)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String stringify(Throwable t) { if (t == null) { return null; }/*from w w w . j a v a 2 s .c om*/ StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); } }