com.boylesoftware.cb2.util
Class ExceptionUtils

java.lang.Object
  extended bycom.boylesoftware.cb2.util.ExceptionUtils

public final class ExceptionUtils
extends java.lang.Object

Collection of static utility methods to work with Java exceptions.

Version:
$Id: ExceptionUtils.java,v 1.1 2004/04/08 18:32:23 levahim Exp $
Author:
Lev Himmelfarb

Constructor Summary
ExceptionUtils()
           
 
Method Summary
static void rethrowBLException(java.lang.Throwable t, java.lang.String message)
          Takes a throwable and rethrows it wrapping it into a BLException if necessary.
static void rethrowServletException(java.lang.Throwable t, java.lang.String message)
          Takes a throwable and rethrows it wrapping it into a ServletException if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionUtils

public ExceptionUtils()
Method Detail

rethrowBLException

public static void rethrowBLException(java.lang.Throwable t,
                                      java.lang.String message)
                               throws BLException
Takes a throwable and rethrows it wrapping it into a BLException if necessary. It wraps the throwable into a BLException if it is not already an instance of BLException, nor RuntimeException and nor Error, in which case it rethrows the throwable as it is.

Parameters:
t - the throwable.
message - error message to set in the BLException if the original throwable needs to be wrapped.
Throws:
BLException - if the throwable is not a RuntimeException nor Error. If the throwable is already an instance of BLException the exception thrown by this method is exactly the same instance.

rethrowServletException

public static void rethrowServletException(java.lang.Throwable t,
                                           java.lang.String message)
                                    throws javax.servlet.ServletException,
                                           java.io.IOException
Takes a throwable and rethrows it wrapping it into a ServletException if necessary. It wraps the throwable into a ServletException if it is not already an instance of ServletException, nor IOException, nor RuntimeException and nor Error, in which case it rethrows the throwable as it is.

Parameters:
t - the throwable.
message - error message to set in the ServletException if the original throwable needs to be wrapped.
Throws:
javax.servlet.ServletException - if the throwable is not a RuntimeException, nor Error, nor IOException. If the throwable is already an instance of ServletException the exception thrown by this method is exactly the same instance.
java.io.IOException - if the throwable is a IOException instance already.


Copyright © 2002,2003,2004 - Boyle Software, Inc.