javautils
Class Exceptions

java.lang.Object
  |
  +--javautils.Exceptions

public class Exceptions
extends java.lang.Object

Static utility methods for dealing with exceptions.


Constructor Summary
Exceptions()
           
 
Method Summary
static java.lang.Throwable getRootCause(java.lang.Throwable t)
          The root cause of the given throwable.
static java.lang.RuntimeException toThrowUnchecked(java.lang.Throwable t)
          Throws the Throwable as an uncheched exception or wraps it inside a RuntimeException to be thrown by the caller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exceptions

public Exceptions()
Method Detail

getRootCause

public static java.lang.Throwable getRootCause(java.lang.Throwable t)

The root cause of the given throwable.


toThrowUnchecked

public static java.lang.RuntimeException toThrowUnchecked(java.lang.Throwable t)

Throws the Throwable as an uncheched exception or wraps it inside a RuntimeException to be thrown by the caller.

This method is intended to be used for translating checked exceptions to unchecked exceptions using code like this:

 try {
   // ...an operation that may throw a checked exception...
 } catch (Exception e) {
   throw toThrowUnchecked(e);
 }