|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception oracle.ide.exception.ChainedException
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; } }
SQLException
,
Exception
,
Serialized FormConstructor 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 |
public ChainedException(java.lang.String msg, java.lang.Exception nextException)
nextException
- the next exception in the chainpublic ChainedException(java.lang.Exception nextException)
nextException
- the next exception in the chainpublic ChainedException(java.lang.String msg)
Method Detail |
public final java.lang.Exception getNextException()
public final void setNextException(java.lang.Exception nextException)
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.