Extension SDK 10.1.2

oracle.ide.exception
Class ChainedException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byoracle.ide.exception.ChainedException
All Implemented Interfaces:
java.io.Serializable

public class ChainedException
extends java.lang.Exception

ChainedException exception class is a base Exception type supporting exceptions which wrap others. An example of this is when you throw an exception because of a failure in another subsystem.

Typically you should be walking backwards from the top most exception down to the root cause of the failure which initially threw the exception. It could be argued that it should be called the previous exception instead of the next exception, however next was choosen to mimic the behavior of the SQLException class which is familiar to some Java developers.

Example:

 try {
   DriverManager.getConnection(url, props);
 } catch (SQLException sqlEx) {
   // This SQLException is the root cause of the failure, and will be at
   // the bottom of the exception chain.
   throw new ChainedException (Res.getString(Res.CANNOT_GET_LIST_OF_TABLES,
                               sqlEx);
 }

 // Later on in your code where you finally catch this ChainedException

 catch (ChainException cEx) {
   Exception ex = cEx;
   while (ex != null) {
     ex.printStackTrace();
     if (ex instanceof ChainedException) {
       ex = ex.getNextException();
     } else {
       ex = null;
     }
   }

 

See Also:
SQLException, Exception, Serialized Form

Constructor Summary
ChainedException(java.lang.Exception nextException)
          Constructor.
ChainedException(java.lang.String msg)
          Constructor.
ChainedException(java.lang.String msg, java.lang.Exception nextException)
          Constructor.
 
Method Summary
 java.lang.Exception getNextException()
          Returns the next Exception in the chain
 void setNextException(java.lang.Exception nextException)
          Sets the next Exception in the chain
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChainedException

public ChainedException(java.lang.String msg,
                        java.lang.Exception nextException)
Constructor.

Parameters:
nextException - the next exception in the chain

ChainedException

public ChainedException(java.lang.Exception nextException)
Constructor.

Parameters:
nextException - the next exception in the chain

ChainedException

public ChainedException(java.lang.String msg)
Constructor.

Method Detail

getNextException

public final java.lang.Exception getNextException()
Returns the next Exception in the chain


setNextException

public final void setNextException(java.lang.Exception nextException)
Sets the next Exception in the chain


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.