List of utility methods to do Exception to String
String | exception2string(Throwable exception) exceptionstring StackTraceElement[] es = exception.getStackTrace(); StringBuilder builder = new StringBuilder(); builder.append(exception.toString()); for (StackTraceElement e : es) { builder.append("\n\tat "); builder.append(e.toString()); return builder.toString(); ... |
String | exception2StringShort(Exception e) Extrahieren der root-Exception aus einer Exception-Chain. StringBuffer st = new StringBuffer(); Throwable e2 = e; while (e2 != null) { String exClass = e2.getClass().getName(); String msg = e2.getMessage(); if (msg != null) { st.setLength(0); st.append(exClass); ... |
String | exception_details(Exception e) exceptiodetails e.printStackTrace(); return "Exception thrown: " + e.getClass().getName() + " : " + e.getMessage(); |
String | exception_details(Exception e, String message) Prepare an exception string suitable for presentation (no stack trace). if (e == null) { return ""; e.printStackTrace(); String emessage = e.getMessage(); if (emessage == null) { emessage = "No Message"; return "Exception: " + e.getClass().getName() + "\n" + ((message != null) ? message + "\n" : "") + emessage.replaceAll("<", "<"); |
String | exceptionFormat(E exception) exception Format Exception e = (Exception) exception;
Integer line = null;
String className = null;
String methodName = null;
if (e.getStackTrace() != null && e.getStackTrace().length > 2) {
line = e.getStackTrace()[2].getLineNumber();
className = e.getStackTrace()[2].getClassName();
methodName = e.getStackTrace()[2].getMethodName();
...
|
String | exceptionStackToString(Throwable x) exception Stack To String if (x == null) return ("NULL exception!"); return (throwableToString(x, "")); |
String | exceptionToString(final Exception e) exception To String return "<span style='color:red; font-size:10px;'>" + e.toString() + "</span>"; |
String | exceptionToString(final Throwable ex) exception To String return exceptionToString(ex, "; "); |
String | exceptionToString(final Throwable throwable) exception To String StringBuilder result = new StringBuilder(); Throwable cause = throwable; while (cause != null) { if (result.length() == 0) { result.append("\nException in thread."); } else { result.append("\nCaused by: "); result.append(cause.getClass().getCanonicalName()).append(": ").append(cause.getMessage()); for (final StackTraceElement traceElement : cause.getStackTrace()) { result.append("\n\tat ").append(traceElement.toString()); cause = cause.getCause(); return result.toString(); |
String | exceptionToString(Throwable e) Returns a String representation of Exception + stacktrace return exceptionToString(e, false);
|