net.sourceforge.groboutils.util.throwable.v1
Class ChainableException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bynet.sourceforge.groboutils.util.throwable.v1.ChainableException
All Implemented Interfaces:
IChainableException, java.io.Serializable

public class ChainableException
extends java.lang.Exception
implements IChainableException

General chainable exception, for pseudo-JDK 1.4 support.

Since:
July 7, 2002
Version:
$Date: 2003/09/23 19:54:07 $
Author:
Matt Albrecht groboclown@users.sourceforge.net
See Also:
Serialized Form

Constructor Summary
ChainableException()
           
ChainableException(java.lang.String message)
           
ChainableException(java.lang.String message, java.lang.Throwable cause)
           
ChainableException(java.lang.Throwable cause)
           
ChainableException(java.lang.Throwable cause, java.lang.String message)
           
 
Method Summary
 java.lang.Throwable getCause()
          JDK 1.4 compatible method.
 java.lang.Throwable initCause(java.lang.Throwable cause)
          JDK 1.4 compatible method.
 void printStackTrace(java.io.PrintStream ps)
          For non-JDK 1.4 compatible VMs, this overrides the original behavior to describe the underlying cause.
 void printStackTrace(java.io.PrintWriter pw)
          For non-JDK 1.4 compatible VMs, this overrides the original behavior to describe the underlying cause.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChainableException

public ChainableException()

ChainableException

public ChainableException(java.lang.String message)

ChainableException

public ChainableException(java.lang.Throwable cause)

ChainableException

public ChainableException(java.lang.Throwable cause,
                          java.lang.String message)

ChainableException

public ChainableException(java.lang.String message,
                          java.lang.Throwable cause)
Method Detail

getCause

public java.lang.Throwable getCause()
JDK 1.4 compatible method.

from the JDK 1.4 documentation:

Returns the cause of this throwable or null if the cause is nonexistent or unknown. (The cause is the throwable that caused this throwable to get thrown.)

This implementation returns the cause that was supplied via one of the constructors requiring a Throwable, or that was set after creation with the initCause( Throwable ) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means. This is appropriate for a "legacy chained throwable" that predates the addition of chained exceptions to Throwable. Note that it is not necessary to override any of the PrintStackTrace methods, all of which invoke the getCause method to determine the cause of a throwable.

Specified by:
getCause in interface IChainableException
Returns:
the cause of this throwable or null if the cause is nonexistent or unknown.

initCause

public java.lang.Throwable initCause(java.lang.Throwable cause)
JDK 1.4 compatible method.

from the JDK 1.4 documentation:

Initializes the cause of this throwable to the specified value. (The cause is the throwable that caused this throwable to get thrown.)

This method can be called at most once. It is generally called from within the constructor, or immediately after creating the throwable. If this throwable was created with Throwable(Throwable) or Throwable(String,Throwable), this method cannot be called even once.

Specified by:
initCause in interface IChainableException
Parameters:
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
Returns:
a reference to this Throwable instance.
Throws:
java.lang.IllegalArgumentException - if cause is this throwable. (A throwable cannot be its own cause.)
java.lang.IllegalStateException - if this throwable was created with Throwable(Throwable) or Throwable(String,Throwable), or this method has already been called on this throwable.

printStackTrace

public void printStackTrace(java.io.PrintStream ps)
For non-JDK 1.4 compatible VMs, this overrides the original behavior to describe the underlying cause. Special logic is performed to ensure that no JDK 1.4 VM is being used when the inner exception is displayed (in order to prevent double printing).

Specified by:
printStackTrace in interface IChainableException

printStackTrace

public void printStackTrace(java.io.PrintWriter pw)
For non-JDK 1.4 compatible VMs, this overrides the original behavior to describe the underlying cause. Special logic is performed to ensure that no JDK 1.4 VM is being used when the inner exception is displayed (in order to prevent double printing).

Specified by:
printStackTrace in interface IChainableException


Copyright © 2001-2003 by The GroboUtils Project