org.mule.util
Class ExceptionUtils

java.lang.Object
  extended by org.apache.commons.lang.exception.ExceptionUtils
      extended by org.mule.util.ExceptionUtils

public class ExceptionUtils
extends org.apache.commons.lang.exception.ExceptionUtils

Mule exception utilities.


Constructor Summary
ExceptionUtils()
           
 
Method Summary
static boolean containsType(Throwable throwable, Class<?> type)
          This method returns true if the throwable contains a Throwable that matches the specified class or subclass in the exception chain.
static
<ET> ET
getDeepestOccurenceOfType(Throwable throwable, Class<ET> type)
          This method returns the throwable closest to the root cause that matches the specified class or subclass.
static String getFullStackTraceWithoutMessages(Throwable throwable)
          Similar to ExceptionUtils.getFullStackTrace(Throwable) but removing the exception and causes messages.
 
Methods inherited from class org.apache.commons.lang.exception.ExceptionUtils
addCauseMethodName, getCause, getCause, getFullStackTrace, getMessage, getRootCause, getRootCauseMessage, getRootCauseStackTrace, getStackFrames, getStackTrace, getThrowableCount, getThrowableList, getThrowables, indexOfThrowable, indexOfThrowable, indexOfType, indexOfType, isCauseMethodName, isNestedThrowable, isThrowableNested, printRootCauseStackTrace, printRootCauseStackTrace, printRootCauseStackTrace, removeCauseMethodName, removeCommonFrames, setCause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionUtils

public ExceptionUtils()
Method Detail

containsType

public static boolean containsType(Throwable throwable,
                                   Class<?> type)
This method returns true if the throwable contains a Throwable that matches the specified class or subclass in the exception chain. Subclasses of the specified class do match.

Parameters:
throwable - the throwable to inspect, may be null
type - the type to search for, subclasses match, null returns false
Returns:
the index into the throwable chain, false if no match or null input

getDeepestOccurenceOfType

public static <ET> ET getDeepestOccurenceOfType(Throwable throwable,
                                                Class<ET> type)
This method returns the throwable closest to the root cause that matches the specified class or subclass. Any null argument will make the method return null.

Parameters:
throwable - the throwable to inspect, may be null
type - the type to search for, subclasses match, null returns null
Returns:
the throwable that is closest to the root in the throwable chain that matches the type or subclass of that type.

getFullStackTraceWithoutMessages

public static String getFullStackTraceWithoutMessages(Throwable throwable)
Similar to ExceptionUtils.getFullStackTrace(Throwable) but removing the exception and causes messages. This is useful to determine if two exceptions have matching stack traces regardless of the messages which may contain invokation specific data

Parameters:
throwable - the throwable to inspect, may be null
Returns:
the stack trace as a string, with the messages stripped out. Empty string if throwable was null


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.