common-util

local.tomas.util
Class Exceptions

java.lang.Object
  extended by local.tomas.util.Exceptions

public final class Exceptions
extends Object

This helper class contains some static methods for exception handling.

Author:
tomas

Method Summary
static String getLocalizedMessage(Throwable ex)
          Get localized message from exception.
static String getMessage(Throwable ex)
          Get message from exception.
static Throwable getRootCause(Throwable ex)
          Get the last root cause in a chain of exceptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRootCause

public static Throwable getRootCause(Throwable ex)
Get the last root cause in a chain of exceptions.

Parameters:
ex - start of chain
Returns:
last root cause

getMessage

public static String getMessage(Throwable ex)
Get message from exception. The message is retrieved from the root cause if the exception itself returns no message.

Parameters:
ex - the exception
Returns:
the message

getLocalizedMessage

public static String getLocalizedMessage(Throwable ex)
Get localized message from exception. The message is retrieved from the root cause if the exception itself returns no localized message.

Parameters:
ex - the exception
Returns:
the message

common-util

Copyright © 2005-2007 Tomas Teubner. All Rights Reserved.