Class ExceptionUtil
- java.lang.Object
-
- com.norconex.commons.lang.ExceptionUtil
-
public final class ExceptionUtil extends Object
Exception-related utility methods.- Since:
- 2.0.0
- Author:
- Pascal Essiembre
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetFormattedMessages(Throwable throwable)Gets a formatted string made of short messages summarizing all exceptions objects in the exception chain, starting with and including the supplied exception.static List<String>getMessageList(Throwable throwable)Gets a list of short messages summarizing all exceptions objects in the exception chain, starting with and including the supplied exception.
-
-
-
Method Detail
-
getFormattedMessages
public static String getFormattedMessages(Throwable throwable)
Gets a formatted string made of short messages summarizing all exceptions objects in the exception chain, starting with and including the supplied exception.
Each messages returned are in the form {ClassNameWithoutPackage}: {ThrowableMessage}. Exceptions with
nullmessages are returned as empty strings.This method handles infinite loops. A
nullexception returns an empty string (nevernull).- Parameters:
throwable- the throwable to inspect, may benull- Returns:
- formatted string or empty string, never
null
-
getMessageList
public static List<String> getMessageList(Throwable throwable)
Gets a list of short messages summarizing all exceptions objects in the exception chain, starting with and including the supplied exception.
Each messages returned are in the form {ClassNameWithoutPackage}: {ThrowableMessage}. Exceptions with
nullmessages are returned as empty strings.This method handles infinite loops and never returns
null.- Parameters:
throwable- the throwable to inspect, may benull- Returns:
- the list of messages, never
null
-
-