com.emarsys.ecommon.exceptions
Class Exceptions

java.lang.Object
  extended by com.emarsys.ecommon.exceptions.Exceptions

public class Exceptions
extends java.lang.Object

Various utilties for dealing with Exceptions or Throwables respectively.

Author:
Michael "kULO" Kulovits

Field Summary
static ExceptionScenario<java.lang.RuntimeException,java.lang.RuntimeException> SCENARIO_RUNTIME_DEFAULT
           
static java.lang.String SCENARIO_RUNTIME_DEFAULT_NAME
           
 
Constructor Summary
Exceptions()
           
 
Method Summary
static java.lang.Runnable getRunnableIgnoringRuntimeExceptions(java.lang.Runnable runnable, java.lang.Class<?> callerClass)
          Returns a Runnable that performs the same Runnable.run() operation as the passed instance, but will catch any arising RuntimeExceptions and print an error message to a Log for the passed caller Class instance.
static java.lang.String getStackTrace(java.lang.Throwable t)
          Prints the stacktrace of the passed Throwable to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCENARIO_RUNTIME_DEFAULT_NAME

public static final java.lang.String SCENARIO_RUNTIME_DEFAULT_NAME
See Also:
Constant Field Values

SCENARIO_RUNTIME_DEFAULT

public static final ExceptionScenario<java.lang.RuntimeException,java.lang.RuntimeException> SCENARIO_RUNTIME_DEFAULT
Constructor Detail

Exceptions

public Exceptions()
Method Detail

getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable t)
Prints the stacktrace of the passed Throwable to a String.

Parameters:
t - - the Throwable, must not be null
Returns:
always a valid String instance, never null.
Throws:
java.lang.NullPointerException - - if the passed Throwable is null

getRunnableIgnoringRuntimeExceptions

public static java.lang.Runnable getRunnableIgnoringRuntimeExceptions(java.lang.Runnable runnable,
                                                                      java.lang.Class<?> callerClass)
Returns a Runnable that performs the same Runnable.run() operation as the passed instance, but will catch any arising RuntimeExceptions and print an error message to a Log for the passed caller Class instance.

Parameters:
runnable - - the runnable to be wrapped
callerClass - - the calling class to get a Log for
Returns:
always a valid Runnable instance, never null.


Copyright © 2010 emarsys AG. All Rights Reserved.