Here you can find the source of getStackTrace(final Throwable aThrowable)
public static String getStackTrace(final Throwable aThrowable)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static String getStackTrace(final Throwable aThrowable) { String errorMsg = aThrowable.getMessage(); final Writer result = new StringWriter(); final PrintWriter printWriter = new PrintWriter(result); aThrowable.printStackTrace(printWriter); return errorMsg + "\n" + result.toString(); }//from w w w . j ava 2s .c o m }