List of utility methods to do Throwable to String
String | stackTrace(Throwable t) stack Trace StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); String s = sw.toString(); try { sw.close(); } catch (IOException e) { return s; ... |
String | stackTrace(Throwable th) stack Trace if (th == null) return null; java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter pw = new java.io.PrintWriter(sw); th.printStackTrace(pw); return sw.toString(); |
String | stackTrace(Throwable th, String pattern) Return the Stacktrace as String Optional filter every line with Pattern String StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); th.printStackTrace(pw); if (pattern != null) { BufferedReader br = new BufferedReader(new StringReader(sw.toString())); sw = new StringWriter(); String s = null; try { ... |
String | stackTrace(Throwable throwable) Write the given stack trace into a String remove the ats in an attempt to not cause Jenkins problems. StringWriter wrt = new StringWriter(); PrintWriter pw = new PrintWriter(wrt); throwable.printStackTrace(pw); pw.flush(); return wrt.toString(); |
String | stackTraceAsString(final Throwable aError) Extracts the given errors stack trace as a string. checkNull(aError, ERROR_EXCEPTION_ARG_NULL); StringWriter sw = new StringWriter(); PrintWriter w = new PrintWriter(sw); aError.printStackTrace(w); w.flush(); w.close(); return sw.toString(); |
String | stackTraceAsString(Throwable e) stack Trace As String String stackAsString = ""; if (e != null) { StringWriter writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); e.printStackTrace(pw); stackAsString = writer.toString(); return stackAsString; ... |
String | stackTraceAsString(Throwable throwable) Gets the stack trace for a given exception as a string. final StringWriter stringWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.getBuffer().toString(); |
String | stacktraceError(Throwable e) Generate a string with all stacktrace error StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); return sw.toString(); |
String | stackTraceFor(final Throwable exception) stack Trace For ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(baos)); return baos.toString(); } finally { if (baos != null) { try { ... |
String | stackTraceFromException(Throwable ex) stack Trace From Exception if (null == ex) { return EMPTY; StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); return sw.toString(); |