Here you can find the source of getStackTrace(Throwable thrown)
Parameter | Description |
---|---|
thrown | a parameter |
public static String getStackTrace(Throwable thrown)
//package com.java2s; //License from project: Apache License import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; public class Main { /**/*from www. j a va 2 s .c o m*/ * Takes a throwable and puts it's stacktrace into a string. * @param thrown * @return */ public static String getStackTrace(Throwable thrown) { try { Writer writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); thrown.printStackTrace(printWriter); return writer.toString(); } catch (Exception exc) { //System.out.println("JavaRendererUtilties.getStackTrace()"); //return "Error - couldn't retrieve stack trace"; return ""; } } }