Here you can find the source of getStackTrace(@Nonnull final Throwable throwable)
@Nonnull @Deprecated private static String getStackTrace(@Nonnull final Throwable throwable)
//package com.java2s; //License from project: Open Source License import javax.annotation.Nonnull; import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**//from w w w .j a va2 s .c o m * Yoinked from apache commons 3 because that's what we were using. * Keeping this method because of backward compatibility reasons. * We don't want commons-lang-3 as a dependency though. * * @deprecated figure out how to stop using this. */ @Nonnull @Deprecated private static String getStackTrace(@Nonnull final Throwable throwable) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); throwable.printStackTrace(pw); return sw.getBuffer().toString(); } }