org.activemath.abstractcontent
Class MBaseException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.activemath.abstractcontent.MBaseException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MBaseCollectionNotProvidedException, MBaseItemNotFoundException

public class MBaseException
extends Exception

a small exception wrapper for use inside *MBase* classes. It is intended to be subclassed (later) for type-distinct exceptions (so that a type-level decision of exception type can be taken). Exceptions don't need to be wrapped in, however.

Version:
0.1 CVS $Revision: 1.7 $ updated at $Date: 2006/06/09 10:35:45 $ by $Author: paul $
See Also:
Serialized Form

Field Summary
protected  String description
          interally stores this exception's description
protected  Exception exception
          internally stores this exception's given sub-exception
 
Constructor Summary
MBaseException(Exception exception)
          creates a new MBaseException with given exception
MBaseException(String description)
          creates a new MBaseException which has a description
MBaseException(String description, Exception exception)
          creates a new MBaseException with given description and given exception
 
Method Summary
 Exception getWrappedException()
          returns the exception that was wrapped in
 void printStackTrace()
           
 void printStackTrace(PrintStream out)
          Prints the exception's stack trace as well as the wrapped exception's stack-trace, if any.
 void printStackTrace(PrintWriter writer)
           
 String toString()
          returns a string representation of this wrapped exception *
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

description

protected String description
interally stores this exception's description


exception

protected Exception exception
internally stores this exception's given sub-exception

Constructor Detail

MBaseException

public MBaseException(String description)
creates a new MBaseException which has a description


MBaseException

public MBaseException(String description,
                      Exception exception)
creates a new MBaseException with given description and given exception

Parameters:
exception - Exception to wrap in (i.e. to keep)
description - Description of exception to give on .toString()

MBaseException

public MBaseException(Exception exception)
creates a new MBaseException with given exception

Parameters:
exception - Exception to wrap in (i.e. to keep) a matching description is automatically created using exception's toString() method
Method Detail

toString

public String toString()
returns a string representation of this wrapped exception *

Overrides:
toString in class Throwable
Returns:
string description of this wrapped exception

getWrappedException

public Exception getWrappedException()
returns the exception that was wrapped in

Returns:
the exception wrapped in; null, if none was provided

printStackTrace

public void printStackTrace(PrintStream out)
Prints the exception's stack trace as well as the wrapped exception's stack-trace, if any.

Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintWriter writer)
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace()
Overrides:
printStackTrace in class Throwable