Here you can find the source of getRootCauseStackTrace(Throwable throwable)
public static String getRootCauseStackTrace(Throwable throwable)
//package com.java2s; //License from project: LGPL import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String getRootCauseStackTrace(Throwable throwable) { Throwable rootCause = getRootCause(throwable); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); rootCause.printStackTrace(pw);/*from w w w .ja v a2 s. c o m*/ return sw.toString(); } public static Throwable getRootCause(Throwable throwable) { Throwable cause = throwable; while (cause.getCause() != null) { cause = cause.getCause(); } return cause; } }