org.apache.logging.log4j.core.util
Class Throwables

java.lang.Object
  extended by org.apache.logging.log4j.core.util.Throwables

public final class Throwables
extends Object

Helps with Throwable objects.


Method Summary
static void addSuppressed(Throwable throwable, Throwable suppressedThrowable)
          Deprecated. If compiling on Java 7 and above use Throwable#addSuppressed(Throwable). Marked as deprecated because Java 6 is deprecated.
static Throwable[] getSuppressed(Throwable throwable)
          Deprecated. If compiling on Java 7 and above use Throwable#getSuppressed(). Marked as deprecated because Java 6 is deprecated.
static boolean isGetSuppressedAvailable()
          Returns true if the getSuppressed method is available.
static void rethrow(Throwable t)
          Rethrows a Throwable, wrapping checked exceptions into an UndeclaredThrowableException.
static List<String> toStringList(Throwable throwable)
          Converts a Throwable stack trace into a List of Strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addSuppressed

@Deprecated
public static void addSuppressed(Throwable throwable,
                                            Throwable suppressedThrowable)
Deprecated. If compiling on Java 7 and above use Throwable#addSuppressed(Throwable). Marked as deprecated because Java 6 is deprecated.

Has no effect on Java 6 and below.

Parameters:
throwable - a Throwable
suppressedThrowable - a suppressed Throwable
See Also:
Throwable#addSuppressed(Throwable)

getSuppressed

@Deprecated
public static Throwable[] getSuppressed(Throwable throwable)
Deprecated. If compiling on Java 7 and above use Throwable#getSuppressed(). Marked as deprecated because Java 6 is deprecated.

Has no effect on Java 6 and below.

Parameters:
throwable - a Throwable
Returns:
see Java 7's Throwable#getSuppressed()
See Also:
Throwable#getSuppressed()

isGetSuppressedAvailable

public static boolean isGetSuppressedAvailable()
Returns true if the getSuppressed method is available.

Returns:
True if getSuppressed is available.

toStringList

public static List<String> toStringList(Throwable throwable)
Converts a Throwable stack trace into a List of Strings

Parameters:
throwable - the Throwable
Returns:
a List of Strings

rethrow

public static void rethrow(Throwable t)
Rethrows a Throwable, wrapping checked exceptions into an UndeclaredThrowableException.

Parameters:
t - the Throwable to throw.
Throws:
RuntimeException - if t is a RuntimeException
Error - if t is an Error
UndeclaredThrowableException - if t is a checked Exception
Since:
2.1


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.