SilverStream
Application Server 3.5

com.sssw.rt.util
Class AgoException

java.lang.Object
 |
 +--java.lang.Throwable
       |
       +--java.lang.Exception
             |
             +--com.sssw.rt.util.AgoException
All Implemented Interfaces:
AgiParentedException, Serializable
Direct Known Subclasses:
AgoApiException, AgoHTTPStatusException, com.sssw.srv.mail.AgoInternetClientException, AgoNotSupportedException, AgoValidationException, AgoVersionUnsupportedException

public class AgoException
extends Exception
implements AgiParentedException

The AgoException class is the base class of all SilverStream declared exceptions. They, like Exception, are a form of Throwable that indicates conditions that an application might want to catch.

See Also:
Serialized Form

Constructor Summary
AgoException()
          Creates an AgoException with no message or parent exception.
AgoException(String message)
          Creates an AgoException with a message and no parent exception.
AgoException(Throwable parent, String message)
          Creates an AgoException with a message and a parent exception.
 
Method Summary
 void copyTo(AgoException translatedX)
          copyTo This method is used in exception translation, to initialize a new "translated" exception with the same resource manager and message as the original.
static String getExceptionHTML(Throwable e)
          Return the HTML contained in e or one of its ancestors.
static String getExceptionMessage(Throwable e)
          return the concatenation of all the messages of the e and its ancestors
static String getExceptionMessage(Throwable e, Locale locale)
          return the concatenation of all the messages of the e and its ancestors
 String getHTML()
          Returns the HTML contained in e or null if no HTML has been set in e.
 String getMessage()
          Returns the detail message of exception e or null if this exception did not have a detailed message.
 String getMessage(Locale locale)
          Returns the detail message of exception e or null if this exception did not have a detailed message.
static Throwable getParentException(Throwable e)
          Returns the parent exception of this exception, if any.
static void printStackTrace(Throwable e)
          Prints the messages for all exceptions in the chain, and the stack trace for the last one.
static void printStackTrace(Throwable e, PrintStream stream)
          Prints the messages for all exceptions in the chain, and the stack trace for the last one
static void printStackTrace(Throwable e, PrintWriter writer)
          Prints the messages for all exceptions in the chain, and the stack trace for the last one
 void setHTML(String html)
          Sets the HTML string associated with the exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.util.AgiParentedException
getExceptionParent
 

Constructor Detail

AgoException

public AgoException()
Creates an AgoException with no message or parent exception.
Example:
 throw new AgoException();
 

AgoException

public AgoException(String message)
Creates an AgoException with a message and no parent exception.
Parameters:
message - the exception detail message
Example:
 throw new AgoException ("Security violation.");
 
See Also:
AgoException.getExceptionMessage(Throwable e ), AgoException.getMessage()

AgoException

public AgoException(Throwable parent,
                    String message)
Creates an AgoException with a message and a parent exception.
Parameters:
parent - the parent exception for this exception. The parent exception along with its message text can later be accessed via this exception.
message - the exception detail message
Example:
 try {
 	...
 }
 catch (Exception e) {
 	// We throw a more specific AgoException, associating the original
 	// exception with it.
 	throw new AgoException (e, "Security violation.");
 }
 
See Also:
AgoException.getParentException(Throwable e ), AgoException.getExceptionMessage(Throwable e ), AgoException.getMessage()
Method Detail

copyTo

public void copyTo(AgoException translatedX)
copyTo This method is used in exception translation, to initialize a new "translated" exception with the same resource manager and message as the original.
Parameters:
translatedX - new exception to store the translated result.
Example:
 AgoException newException = new AgoException();
 
 e.copyTo (newException);
 

getMessage

public String getMessage()
Returns the detail message of exception e or null if this exception did not have a detailed message.
Overrides:
getMessage in class Throwable
Example:
 String msg = e.getMessage();
 
See Also:
AgoException.getExceptionMessage(Throwable e )

getMessage

public String getMessage(Locale locale)
Returns the detail message of exception e or null if this exception did not have a detailed message.
Specified by:
getMessage in interface AgiParentedException
Parameters:
locale - the locale to use when retrieving the message
Example:
 String msg = e.getMessage (Locale.getDefault());
 
See Also:
AgoException.getExceptionMessage(Throwable e )

setHTML

public void setHTML(String html)
Sets the HTML string associated with the exception.
Parameters:
html - the HTML string to associate with the exception
Example:
 e.setHTML ("Exception text...");
 
See Also:
AgoException.getHTML(), AgoException.getExceptionHTML(Throwable e )

getHTML

public String getHTML()
Returns the HTML contained in e or null if no HTML has been set in e.
Example:
 String htmlStr = AgoException.getHTML (e);
 
See Also:
AgoException.setHTML(String html), AgoException.getExceptionHTML(Throwable e )

getExceptionMessage

public static String getExceptionMessage(Throwable e)
return the concatenation of all the messages of the e and its ancestors
Parameters:
e - the exception whose message and ancestor's messages should be returned.
Example:
String msg = AgoException.getExceptionMessage (e);
See Also:
AgoException.getExceptionMessage( Throwable e, Locale locale )

getExceptionMessage

public static String getExceptionMessage(Throwable e,
                                         Locale locale)
return the concatenation of all the messages of the e and its ancestors
Parameters:
e - the exception whose message and ancestor's messages should be returned
locale - the locale to use when retrieving the message text
Example:
 String msg = AgoException.getExceptionMessage (e, Locale.getDefault());
 

printStackTrace

public static void printStackTrace(Throwable e)
Prints the messages for all exceptions in the chain, and the stack trace for the last one.
Parameters:
e - the exception

printStackTrace

public static void printStackTrace(Throwable e,
                                   PrintStream stream)
Prints the messages for all exceptions in the chain, and the stack trace for the last one
Parameters:
e - the exception
stream - the output stream

printStackTrace

public static void printStackTrace(Throwable e,
                                   PrintWriter writer)
Prints the messages for all exceptions in the chain, and the stack trace for the last one
Parameters:
e - the exception
writer - the PrintWriter

getExceptionHTML

public static String getExceptionHTML(Throwable e)
Return the HTML contained in e or one of its ancestors. Assumes that only one exception in the chain should have any HTML. If no exceptions have any HTML then returns null.
Parameters:
e - the exception to start searching for HTML in.
Example:
 String htmlStr = AgoException.getExceptionHTML (e);
 

getParentException

public static Throwable getParentException(Throwable e)
Returns the parent exception of this exception, if any. Handles

Returns null if no parent exception exists.

Parameters:
e - the exception whose parent should be returned
Example:
 Throwable t = AgoException.getParentException (e);
 

SilverStream
Application Server 3.5