List of utility methods to do Exception to String
String | getExceptionMessage(Exception e) Retrieve exception stack message final StringBuilder sb = new StringBuilder(); e.printStackTrace(new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { sb.append((char) b); })); return sb.toString(); ... |
String | getExceptionMessage(Exception ex) get Exception Message StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); return sw.toString(); |
String | getExceptionMessage(Exception ex) get Exception Message return getExceptionMessage(ex, true);
|
String | getExceptionMsg(Exception ex) Get Exception msg. StringBuilder sb = new StringBuilder(); if (ex != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); sb.append(sw.toString()); return sb.toString(); ... |
String | getExceptionName(IOException ex) get Exception Name return ex.getClass().getSimpleName();
|
String | getExceptionStackTrace(Exception exception) get Exception Stack Trace java.io.OutputStream out = new java.io.ByteArrayOutputStream(); java.io.PrintStream ps = new java.io.PrintStream(out, true); exception.printStackTrace(ps); String str = out.toString(); return str; |
String | getExceptionStackTraceAsString(final Exception exception) get Exception Stack Trace As String final StringWriter sw = new StringWriter(); exception.printStackTrace(new PrintWriter(sw)); return sw.toString(); |