Package com.linkedin.venice.utils
Class ExceptionUtils
- java.lang.Object
-
- com.linkedin.venice.utils.ExceptionUtils
-
public class ExceptionUtils extends java.lang.Object
Static utility functions to deal with exceptions. Copied from here: https://github.com/voldemort/voldemort/blob/ea37ef67fa7724180608510c6d4237167b78dd63/src/java/voldemort/utils/ExceptionUtils.java
-
-
Constructor Summary
Constructors Constructor Description ExceptionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
compactExceptionDescription(java.lang.Throwable t)
static java.lang.String
compactExceptionDescription(java.lang.Throwable t, java.lang.String originatingFunctionName)
static void
logClassLoaderContent(java.lang.String packageName)
static boolean
recursiveClassEquals(java.lang.Throwable throwableToInspect, java.lang.Class... throwableClassesToLookFor)
Inspects a givenThrowable
as well as its nested causes, in order to look for a specific set of exception classes.static boolean
recursiveMessageContains(java.lang.Throwable throwableToInspect, java.lang.String message)
Inspects a givenThrowable
as well as its nested causes, in order to look for a specific message.static java.lang.String
stackTraceToString(java.lang.Throwable throwable)
static java.lang.String
threadToThrowableToString(java.lang.Thread thread)
-
-
-
Method Detail
-
recursiveClassEquals
public static boolean recursiveClassEquals(java.lang.Throwable throwableToInspect, java.lang.Class... throwableClassesToLookFor)
Inspects a givenThrowable
as well as its nested causes, in order to look for a specific set of exception classes. The function also detects if the throwable to inspect is a subclass of one of the classes you look for, but not the other way around (i.e.: if you're looking for the subclass but the throwableToInspect is the parent class, then this function returns false).- Returns:
- true if the throwableToInspect corresponds to or is caused by any of the throwableClassesToLookFor
-
recursiveMessageContains
public static boolean recursiveMessageContains(java.lang.Throwable throwableToInspect, java.lang.String message)
Inspects a givenThrowable
as well as its nested causes, in order to look for a specific message.- Returns:
- true if the throwableToInspect contains the message parameter
-
stackTraceToString
public static java.lang.String stackTraceToString(java.lang.Throwable throwable)
- Returns:
- a String representation of the provided throwable's stacktrace.
-
threadToThrowableToString
public static java.lang.String threadToThrowableToString(java.lang.Thread thread)
-
logClassLoaderContent
public static void logClassLoaderContent(java.lang.String packageName)
-
compactExceptionDescription
public static java.lang.String compactExceptionDescription(java.lang.Throwable t)
-
compactExceptionDescription
public static java.lang.String compactExceptionDescription(java.lang.Throwable t, java.lang.String originatingFunctionName)
-
-