List of utility methods to do Throwable to String
void | printStackTrace(Throwable t) print Stack Trace serr(); t.printStackTrace(); |
String | serialize(Throwable t) serialize StringWriter errors = new StringWriter(); t.printStackTrace(new PrintWriter(errors)); return errors.toString(); |
String | serializeStackTrace(Throwable _t) Serialize stack trace. java.io.ByteArrayOutputStream byteArrayOutputStream = new java.io.ByteArrayOutputStream(); java.io.PrintWriter printWriter = null; String errorString = null; try { printWriter = new java.io.PrintWriter(byteArrayOutputStream, true); _t.printStackTrace(printWriter); errorString = byteArrayOutputStream.toString(); } catch (Throwable u) { ... |
String | serializeStackTrace(Throwable th) Gets a string representation of a stack trace. ByteArrayOutputStream bout = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(bout); th.printStackTrace(pw); pw.close(); return bout.toString(); |
String | stackToString(Exception e) stack To String try { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); return "------\n" + sw.toString() + "------\n"; } catch (Exception e2) { return "bad stackToString"; |
String | stackToString(Throwable e) Get a string containing the stack of the specified exception java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); return sw.getBuffer().toString(); |
String | stackToString(Throwable e) Get a string containing the stack of the specified exception java.io.StringWriter sw = new java.io.StringWriter(); java.io.BufferedWriter bw = new java.io.BufferedWriter(sw); java.io.PrintWriter pw = new java.io.PrintWriter(bw); e.printStackTrace(pw); pw.close(); String text = sw.getBuffer().toString(); text = text.substring(text.indexOf("at")); text = replace(text, "at ", "DEBUG_FRAME = "); ... |
String | stackToString(Throwable e) stack To String java.io.StringWriter sw = new java.io.StringWriter(1024); java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.close(); return sw.toString(); |
String | stackToString(Throwable t) Writes a throwed exception to a string for streaming to the server Writer result = new StringWriter(); PrintWriter printWriter = new PrintWriter(result); t.printStackTrace(printWriter); return result.toString(); |
StringBuffer | stackToString(Throwable throwable, boolean skipMessage) Dump message and stack to StringBuffer. if (null == throwable) { return new StringBuffer(); StringWriter buf = new StringWriter(); PrintWriter writer = new PrintWriter(buf); if (!skipMessage) { writer.println(throwable.getMessage()); throwable.printStackTrace(writer); try { buf.close(); } catch (IOException ioe) { return buf.getBuffer(); |