public final class ExceptionUtility extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isThrownAsOfAlreadyClosed(IOException aException)
Tests whether the provided exception is thrown as of something already
being closed.
|
static Throwable |
toException(Collection<?> aExceptionProperty)
Iterates through the objects passed in the collection and tests them
whether them implement the
ExceptionAccessor . |
static String |
toMessage(Throwable aThrowable)
Generates an exception message from the given exception.
|
static Throwable |
toRootCause(Throwable aThrowable)
Traverses through the
Throwable 's cause instances recursively
until the root cause is detected (this is the cause which has no cause
any more). |
static String |
toStackTrace(Throwable aThrowable)
Retrieves a stack trace from the given exception.
|
public static String toMessage(Throwable aThrowable)
aThrowable
- The exception from which to create the message.public static String toStackTrace(Throwable aThrowable)
aThrowable
- The exception from which to get the stack trace.public static Throwable toException(Collection<?> aExceptionProperty)
ExceptionAccessor
. The first one found
implementing the ExceptionAccessor
and returning an exception
(instead of null), than this exception is returned.aExceptionProperty
- The objects to test whether them implement the
ExceptionAccessor
.ExceptionAccessor
and not returning null when calling
ExceptionAccessor.getException()
.public static Throwable toRootCause(Throwable aThrowable)
Throwable
's cause instances recursively
until the root cause is detected (this is the cause which has no cause
any more).public static boolean isThrownAsOfAlreadyClosed(IOException aException)
aException
- The IOException
to be tested.Copyright © 2018. All rights reserved.