Package dk.netarkivet.common.utils
Class ExceptionUtils
- java.lang.Object
-
- dk.netarkivet.common.utils.ExceptionUtils
-
public class ExceptionUtils extends java.lang.Object
Utilities for reading a stacktrace.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Throwable
getRootCause(java.lang.Throwable crawlException)
static java.lang.String
getSQLExceptionCause(java.sql.SQLException e)
SQLExceptions have their own stack of causes accessed via the getNextException() method.static java.lang.String
getStackTrace(java.lang.Throwable aThrowable)
Prints the stacktrace of an exception to a String.
-
-
-
Method Detail
-
getStackTrace
public static java.lang.String getStackTrace(java.lang.Throwable aThrowable)
Prints the stacktrace of an exception to a String. Why this functionality is not included in the standard java libraries is anybody's guess.- Parameters:
aThrowable
- An exception- Returns:
- String containing a stacktrace of exception aThrowable. Will return the string "null" and a linebreak if aThrowable is null.
-
getSQLExceptionCause
public static java.lang.String getSQLExceptionCause(java.sql.SQLException e)
SQLExceptions have their own stack of causes accessed via the getNextException() method. This utility provides a string representation of those causes for use in logging or rethrowing- Parameters:
e
- the original top-level exception- Returns:
- a String describing the exception
-
getRootCause
public static java.lang.Throwable getRootCause(java.lang.Throwable crawlException)
-
-