Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.ide.exception
Class ChainedException

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

Deprecated. since 11.0. Exception has supported exception chaining since J2SE 1.4.

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)
          Deprecated. Constructor.
ChainedException(java.lang.String msg)
          Deprecated. Constructor.
ChainedException(java.lang.String msg, java.lang.Exception nextException)
          Deprecated. Constructor.
 
Method Summary
 java.lang.Exception getNextException()
          Deprecated. Returns the next Exception in the chain
 void setNextException(java.lang.Exception nextException)
          Deprecated. 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)
Deprecated. 
Constructor.

Parameters:
s - The message of the Exception
nextException - the next exception in the chain

ChainedException

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

Parameters:
nextException - the next exception in the chain

ChainedException

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

Parameters:
s - The message of the Exception
Method Detail

getNextException

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


setNextException

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


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

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