public class ExceptionUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.io.File |
assertExists(java.io.File file) |
static java.nio.file.Path |
assertExists(java.nio.file.Path path) |
static java.io.File |
assertIsDirectory(java.io.File file) |
static java.nio.file.Path |
assertIsDirectory(java.nio.file.Path path) |
static java.io.File |
assertIsFile(java.io.File file) |
static java.nio.file.Path |
assertIsFile(java.nio.file.Path path) |
static long |
assertNegative(long value,
java.lang.String name) |
static <T> java.util.Collection<T> |
assertNotEmpty(java.util.Collection<T> value,
java.lang.String name) |
static <T> T[] |
assertNotEmpty(T[] value,
java.lang.String name) |
static <T> T |
assertNotNull(T value,
java.lang.String name) |
static java.lang.String |
assertNotZeroLength(java.lang.String value,
java.lang.String name) |
static long |
assertPositive(long value,
java.lang.String name) |
static java.lang.String |
getMessage(java.lang.Throwable ex)
Gets the message for an exception taking into consideration that
not all exceptions (ie NPE) will have a message in which case the
class's name will be used in lue of no message.
|
static java.lang.Throwable |
getRootCause(java.lang.Throwable e) |
static java.util.List<? extends java.lang.Throwable> |
getRootCauses(java.lang.Throwable e) |
static java.lang.String |
getRootMessage(java.lang.Throwable ex)
Gets the message for an exception's root exception taking into
consideration that not all exceptions (ie NPE) will have a message
in which case the class's name will be used in lue of no message.
|
static java.lang.String |
getStackTrace(java.lang.Throwable e) |
static java.lang.String |
toString(java.lang.Throwable e) |
public static java.nio.file.Path assertIsFile(java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionpublic static java.io.File assertIsFile(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static java.nio.file.Path assertIsDirectory(java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionpublic static java.io.File assertIsDirectory(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static java.nio.file.Path assertExists(java.nio.file.Path path)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static java.io.File assertExists(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static java.lang.String assertNotZeroLength(java.lang.String value,
java.lang.String name)
public static <T> T assertNotNull(T value,
java.lang.String name)
public static <T> T[] assertNotEmpty(T[] value,
java.lang.String name)
public static <T> java.util.Collection<T> assertNotEmpty(java.util.Collection<T> value,
java.lang.String name)
public static long assertPositive(long value,
java.lang.String name)
public static long assertNegative(long value,
java.lang.String name)
public static java.lang.String toString(java.lang.Throwable e)
public static java.lang.Throwable getRootCause(java.lang.Throwable e)
public static java.lang.String getMessage(java.lang.Throwable ex)
ex - any throwablepublic static java.lang.String getRootMessage(java.lang.Throwable ex)
ex - any throwablepublic static java.lang.String getStackTrace(java.lang.Throwable e)
public static java.util.List<? extends java.lang.Throwable> getRootCauses(java.lang.Throwable e)