List of utility methods to do Throwable to String
String | getExceptionString(Throwable e) get Exception String if (e == null) return ""; StringWriter strWriter = new StringWriter(); PrintWriter writer = new PrintWriter(strWriter, true); e.printStackTrace(writer); StringBuffer sb = strWriter.getBuffer(); String s = "cause by: \n\t" + sb.toString(); return s.replace("Caused by:", "<font color='red'>Caused by:"); ... |
String | getExceptionString(Throwable t) Returns exception string for class StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); |
String | getExceptionString(Throwable throwable) getExceptionString StringWriter stringWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.toString(); |
String | getExceptionText(Throwable e) get Exception Text StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.print(e.toString() + "\n" + e.getMessage() + "\n"); e.printStackTrace(pw); return sw.toString(); |
String | getExceptionTrace(Throwable e) Get the stack trace of the exception. if (e != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); return sw.toString(); return "No Exception"; |
String | getStackTrace(final Throwable e) get Stack Trace final Writer sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); return sw.toString(); |
String | getStackTrace(@Nonnull final Throwable throwable) Yoinked from apache commons 3 because that's what we were using. final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); throwable.printStackTrace(pw); return sw.getBuffer().toString(); |
String | getStackTrace(final Throwable aThrowable) get Stack Trace String errorMsg = aThrowable.getMessage(); final Writer result = new StringWriter(); final PrintWriter printWriter = new PrintWriter(result); aThrowable.printStackTrace(printWriter); return errorMsg + "\n" + result.toString(); |
String | getStackTrace(final Throwable e) Gets the stack trace of exception as string final StringWriter s = new StringWriter(); e.printStackTrace(new PrintWriter(s)); return s.toString(); |
String | getStackTrace(final Throwable error) Returns error stacktrace as a String. StringWriter writer = new StringWriter(); for (StackTraceElement element : error.getStackTrace()) { writer.write(element.toString()); try { return writer.toString(); } finally { try { ... |