Package dk.netarkivet.common.utils
Class ExceptionUtils
- java.lang.Object
-
- dk.netarkivet.common.utils.ExceptionUtils
-
public class ExceptionUtils extends Object
Utilities for reading a stacktrace.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Throwable
getRootCause(Throwable crawlException)
static String
getSQLExceptionCause(SQLException e)
SQLExceptions have their own stack of causes accessed via the getNextException() method.static String
getStackTrace(Throwable aThrowable)
Prints the stacktrace of an exception to a String.
-
-
-
Method Detail
-
getStackTrace
public static String getStackTrace(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 String getSQLExceptionCause(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
-
-