Here you can find the source of getStackTrace(Throwable tException)
Parameter | Description |
---|---|
tException | The exception to get the stacktrace of. |
public static String getStackTrace(Throwable tException)
//package com.java2s; //License from project: Apache License import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**/*w w w .ja v a 2 s. c o m*/ * This method returns the string-representation of the stacktrace of the passed on exception. * * @param tException The exception to get the stacktrace of. * * @return The string-representation of the stacktrace. */ public static String getStackTrace(Throwable tException) { // Get the stack-trace StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); tException.printStackTrace(pw); pw.flush(); return sw.getBuffer().toString(); } }