public final class ExceptUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEqual(Throwable t,
Object o)
Checks whether the given throwable is equal to the given
object.
|
static void |
checkInterruption()
Checks whether the calling thread has been interrupted, and, if
so, throws an
InterruptedException with the default
interruption message and no underlying cause. |
static void |
checkInterruption(String message)
Checks whether the calling thread has been interrupted, and, if
so, throws an
InterruptedException with the given
interruption message, but without an underlying cause. |
static void |
checkInterruption(Throwable cause)
Checks whether the calling thread has been interrupted, and, if
so, throws an
InterruptedException with the default
interruption message and the given underlying cause. |
static void |
checkInterruption(Throwable cause,
String message)
Checks whether the calling thread has been interrupted, and, if
so, throws an
InterruptedException with the given
interruption message and the given underlying cause. |
static int |
getHashCode(Throwable t)
Returns the hash code of the given throwable.
|
static String |
getRootCauseMessage(Throwable inException)
Gets the root cause message.
|
static boolean |
interrupt(Throwable throwable)
If the given throwable is an interruption exception per
isInterruptException(Throwable), then the calling thread is
interrupted. |
static boolean |
isInterruptException(Throwable throwable)
Checks if the given throwable is an instance of
InterruptedException, InterruptedIOException, I18NInterruptedException, or I18NInterruptedRuntimeException. |
static boolean |
swallow(Throwable throwable)
Swallows the given throwable.
|
static boolean |
swallow(Throwable throwable,
Object category,
I18NBoundMessage message)
Swallows the given throwable.
|
static I18NException |
wrap(Throwable throwable)
If the given throwable is an interruption exception per
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedException, and this
exception is returned; also, the calling thread is
interrupted. |
static I18NException |
wrap(Throwable throwable,
I18NBoundMessage message)
If the given throwable is an interruption exception per
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedException, and this
exception is returned; also, the calling thread is
interrupted. |
static I18NRuntimeException |
wrapRuntime(Throwable throwable)
If the given throwable is an interruption exception per
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedRuntimeException, and
this exception is thrown; also, the calling thread is
interrupted. |
static I18NRuntimeException |
wrapRuntime(Throwable throwable,
I18NBoundMessage message)
If the given throwable is an interruption exception per
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedRuntimeException, and
this exception is thrown; also, the calling thread is
interrupted. |
public static void checkInterruption()
throws InterruptedException
InterruptedException with the default
interruption message and no underlying cause. The interrupted
status of the thread is cleared.InterruptedException - Thrown if the calling thread
was interrupted.public static void checkInterruption(String message) throws InterruptedException
InterruptedException with the given
interruption message, but without an underlying cause. The
interrupted status of the thread is cleared.message - The message.InterruptedException - Thrown if the calling thread
was interrupted.public static void checkInterruption(Throwable cause) throws InterruptedException
InterruptedException with the default
interruption message and the given underlying cause. The given
underlying cause is set on the thrown exception. The
interrupted status of the thread is cleared.cause - The cause.InterruptedException - Thrown if the calling thread
was interrupted.public static void checkInterruption(Throwable cause, String message) throws InterruptedException
InterruptedException with the given
interruption message and the given underlying cause. The given
underlying cause is set on the thrown exception. The
interrupted status of the thread is cleared.cause - The cause.message - The message.InterruptedException - Thrown if the calling thread
was interrupted.public static boolean isInterruptException(Throwable throwable)
InterruptedException, InterruptedIOException, I18NInterruptedException, or I18NInterruptedRuntimeException.throwable - The throwable.public static boolean interrupt(Throwable throwable)
isInterruptException(Throwable), then the calling thread is
interrupted. Otherwise, this is a no-op.throwable - The throwable.public static boolean swallow(Throwable throwable, Object category, I18NBoundMessage message)
isInterruptException(Throwable), then
the calling thread is interrupted.throwable - The throwable.category - The category.message - The message.public static boolean swallow(Throwable throwable)
isInterruptException(Throwable), then the calling thread is
interrupted.throwable - The throwable.public static I18NException wrap(Throwable throwable, I18NBoundMessage message)
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedException, and this
exception is returned; also, the calling thread is
interrupted. Otherwise, an I18NException is used to
wrap the throwable, and returned. All arguments are passed
as-is into the constructor of the wrapping exception.throwable - The throwable.message - The message.public static I18NException wrap(Throwable throwable)
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedException, and this
exception is returned; also, the calling thread is
interrupted. Otherwise, an I18NException is used to
wrap the throwable, and returned. All arguments are passed
as-is into the constructor of the wrapping exception.throwable - The throwable.public static I18NRuntimeException wrapRuntime(Throwable throwable, I18NBoundMessage message)
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedRuntimeException, and
this exception is thrown; also, the calling thread is
interrupted. Otherwise, an I18NRuntimeException is used
to wrap the throwable. All arguments are passed as-is into the
constructor of the wrapping exception.throwable - The throwable.message - The message.public static I18NRuntimeException wrapRuntime(Throwable throwable)
isInterruptException(Throwable), then the throwable is
wrapped inside a I18NInterruptedRuntimeException, and
this exception is thrown; also, the calling thread is
interrupted. Otherwise, an I18NRuntimeException is used
to wrap the throwable. All arguments are passed as-is into the
constructor of the wrapping exception.throwable - The throwable.public static int getHashCode(Throwable t)
areEqual(Throwable,Object).t - The throwable.public static boolean areEqual(Throwable t, Object o)
t - The throwable. It may be null.o - The object. It may be null.Copyright © 2015. All Rights Reserved.