Class ExceptionUtils
- java.lang.Object
-
- org.glassfish.jersey.internal.util.ExceptionUtils
-
public final class ExceptionUtils extends java.lang.Object
The Exception Utils class provide utility method for exception handling.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ExceptionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Exception>
voidconditionallyReThrow(T e, boolean rethrow, java.util.logging.Logger logger, java.lang.String m, java.util.logging.Level level)
Based on the rethrow parameter, either rethrows the supplied exception or logs the provided message at the given level.static java.lang.String
exceptionStackTraceAsString(java.lang.Throwable t)
Gets the stack trace of the provided throwable as a string.
-
-
-
Method Detail
-
exceptionStackTraceAsString
public static java.lang.String exceptionStackTraceAsString(java.lang.Throwable t)
Gets the stack trace of the provided throwable as a string.- Parameters:
t
- the exception to get the stack trace for.- Returns:
- the stack trace as a string.
-
conditionallyReThrow
public static <T extends java.lang.Exception> void conditionallyReThrow(T e, boolean rethrow, java.util.logging.Logger logger, java.lang.String m, java.util.logging.Level level) throws T extends java.lang.Exception
Based on the rethrow parameter, either rethrows the supplied exception or logs the provided message at the given level.- Type Parameters:
T
- the type of the exception to be conditionally rethrown.- Parameters:
e
- the exception to rethrow if rethrow istrue
.rethrow
- whether to rethrow an exception or just log the provided message.logger
- the logger to print the message with.m
- the message to log if rethrow isfalse
.level
- the level of the logged message.- Throws:
T
- if rethrow istrue
.T extends java.lang.Exception
-
-