java.lang
Class Throwable

java.lang.Object
  extended by java.lang.Throwable
Direct Known Subclasses:
Error, Exception

public class Throwable
extends Object

All exceptions and errors extend this class.


Constructor Summary
Throwable()
          Create a Throwable object.
Throwable(String message)
          Create a Throwable object.
 
Method Summary
 Throwable fillInStackTrace()
          Capture a stack trace.
 String getLocalizedMessage()
          Can be overridden, to return localized messages.
 String getMessage()
          Return the message associated with this Throwable object.
 void printStackTrace()
          Print details of the exception/error on the system error stream.
 void printStackTrace(PrintStream s)
          Print details of the exception/error to the provided stream.
 String toString()
          Return a string version of the Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Throwable

public Throwable()
Create a Throwable object. Call fillInStackTrace to create a trace of stack when the Throwable was created.


Throwable

public Throwable(String message)
Create a Throwable object. Call fillInStackTrace to create a trace of stack when the Throwable was created. Set the message to the provided string.

Parameters:
message - Message providing details of the error/exception.
Method Detail

getLocalizedMessage

public String getLocalizedMessage()
Can be overridden, to return localized messages. The default implementation returns the same as getMessage().

Returns:
Localized message string or null if there is no message

getMessage

public String getMessage()
Return the message associated with this Throwable object.

Returns:
Message string or null if there is no message.

toString

public String toString()
Return a string version of the Throwable. This will consist of details of the actual class and the detail message if set.

Overrides:
toString in class Object
Returns:
A string representation.

fillInStackTrace

public Throwable fillInStackTrace()
Capture a stack trace. Note that the frames containing this (and other calls directly relating to the Throwable object). will be omitted.

Returns:
The Throwable object.

printStackTrace

public void printStackTrace(PrintStream s)
Print details of the exception/error to the provided stream. The details will contain the throwable class, the text of the detail message (if any) and a series of lines providing a stack trace at the time the Throwable was created.

Parameters:
s - The print stream on which to output the trace.

printStackTrace

public void printStackTrace()
Print details of the exception/error on the system error stream. See