question: public static String exceptionChainToString ( Throwable t ) { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw , true ) ; while ( t != null ) { t . printStackTrace ( pw ) ; t = t . getCause ( ) ; } pw . flush ( ) ; sw . flush ( ) ; return sw . toString ( ) ; }
target:  Prints full exception stack trace, from top to root cause, into a String.