org.griphyn.common.catalog
Class CatalogException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.griphyn.common.catalog.CatalogException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ReplicaCatalogException, WorkCatalogException

public class CatalogException
extends RuntimeException

Class to notify of failures. Exceptions are chained like the SQLException interface.

Here is a fragment of code to chain exceptions for later throwing:

 CatalogException rce = null;
 ... some loop code ... {
   ... 
   if ( exception triggered ) {
     if ( rce == null ) rce = new CatalogException( reason );
     else rce.setNextException( new CatalogException(reason) );
   ... 
 } ... loop end ...
 if ( rce != null ) throw rce;
 
Here is a fragment of code to unchain exceptions in the client:

 try {
   ... operation ...
 } catch ( CatalogException rce ) {
   for ( ; rce != null; rce = rce.getNextException ) {
      ... do something with the payload ...
   }
 }
 

Author:
Karan Vahi, Jens-S. V??ckler
See Also:
Serialized Form

Field Summary
private  CatalogException m_next_exception
          chains the next exception into line.
 
Constructor Summary
CatalogException()
           
CatalogException(String s)
          Constructs a CatalogException with the specified detailed message.
CatalogException(String s, Throwable cause)
          Constructs a CatalogException with the specified detailed message and a cause.
CatalogException(Throwable cause)
          Constructs a CatalogException with the specified just a cause.
 
Method Summary
 CatalogException getNextException()
          Retrieves the exception chained to this CatalogException object.
 void setNextException(CatalogException ex)
          Adds an CatalogException object to the end of 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
 

Field Detail

m_next_exception

private CatalogException m_next_exception
chains the next exception into line.

Constructor Detail

CatalogException

public CatalogException()

CatalogException

public CatalogException(String s)
Constructs a CatalogException with the specified detailed message.

Parameters:
s - is the detailled message.

CatalogException

public CatalogException(String s,
                        Throwable cause)
Constructs a CatalogException with the specified detailed message and a cause.

Parameters:
s - is the detailled message.
cause - is the cause (which is saved for later retrieval by the Throwable.getCause() method). A null value is permitted, and indicates that the cause is nonexistent or unknown.

CatalogException

public CatalogException(Throwable cause)
Constructs a CatalogException with the specified just a cause.

Parameters:
cause - is the cause (which is saved for later retrieval by the Throwable.getCause() method). A null value is permitted, and indicates that the cause is nonexistent or unknown.
Method Detail

getNextException

public CatalogException getNextException()
Retrieves the exception chained to this CatalogException object.

Returns:
the next CatalogException object in the chain; null if there are none.
See Also:
setNextException( CatalogException )

setNextException

public void setNextException(CatalogException ex)
Adds an CatalogException object to the end of the chain.

Parameters:
ex - the new exception that will be added to the end of the CatalogException chain.
See Also:
getNextException()


Copyright © 2007 The University of Southern California. All Rights Reserved.