Here you can find the source of getErrorMessage(Throwable e)
public static String getErrorMessage(Throwable e)
//package com.java2s; import java.io.*; public class Main { public static String getErrorMessage(Throwable e) { Writer writer = new StringWriter(); PrintWriter pWriter = new PrintWriter(writer); e.printStackTrace(pWriter);//from w w w . j ava 2 s .c o m return writer.toString(); } }