Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

ptolemy.kernel.util
Class KernelRuntimeException

java.lang.Object
 extended byjava.lang.Throwable
 extended byjava.lang.Exception
 extended byjava.lang.RuntimeException
 extended byptolemy.kernel.util.KernelRuntimeException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
InternalErrorException, InvalidStateException, NoRoomException, NoTokenException, UnknownResultException

public class KernelRuntimeException
extends java.lang.RuntimeException

Base class for runtime exceptions. This class extends the basic Java RuntimeException with a constructor that can take a Nameable as an argument.

This exception supports all the constructor forms of KernelException, but is implemented as a RuntimeException so that it does not have to be declared.

The cause argument to the constructor is a Throwable that caused the exception. The cause argument is used when code throws an exception and we want to rethrow the exception but print the stacktrace where the first exception occurred. This is called exception chaining.

JDK1.4 and later support exception chaining. We are implementing a version of exception chaining here ourselves so that we can use JVMs earlier than JDK1.4. See the KernelException documentation for differences between our exception chaining implementation and the JDK1.4 implementation.

Since:
Ptolemy II 1.0
Version:
$Id: KernelRuntimeException.java,v 1.36 2005年07月08日 19:59:17 cxh Exp $
Author:
Edward A. Lee, Christopher Hylands
See Also:
Serialized Form
Accepted Rating:
Green (cxh)
Proposed Rating:
Green (cxh)

Constructor Summary
KernelRuntimeException()
Construct an exception with no specific detail message.
KernelRuntimeException(java.util.Collection objects, java.lang.Throwable cause, java.lang.String detail)
Construct an exception with a detail message that includes the names of a collection of Nameable objects plus the argument string.
KernelRuntimeException(Nameable object1, Nameable object2, java.lang.Throwable cause, java.lang.String detail)
Construct an exception with a detail message that includes the names of the first two arguments plus the value of the fourth argument string.
KernelRuntimeException(Nameable object, java.lang.String detail)
Construct an exception with a detail message that includes the name of the first argument and the value of the second argument string.
KernelRuntimeException(java.lang.String detail)
Construct an exception with only a detail message.
KernelRuntimeException(java.lang.Throwable cause, java.lang.String detail)
Construct an exception with a cause and a detail message.
Method Summary
protected void _setCause(java.lang.Throwable cause)
Set the cause to the specified throwable.
protected void _setMessage(java.lang.String message)
Sets the error message to the specified string.
java.lang.Throwable getCause()
Get the cause of this exception.
java.lang.String getMessage()
Get the message of this exception.
void printStackTrace()
Print a stack trace message to stderr including this exception, its stack trace and if the cause exception is known, print the cause exception and the cause stacktrace.
void printStackTrace(java.io.PrintStream printStream)
Print a stack trace message to printStream including this exception, its stack trace and if the cause exception is known, print the cause exception and the cause stacktrace.
void printStackTrace(java.io.PrintWriter printWriter)
Print a stack trace message to printWriter including this exception, its stack trace and if the cause exception is known, print the cause exception and the cause stacktrace.
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

KernelRuntimeException

public KernelRuntimeException()
Construct an exception with no specific detail message.


KernelRuntimeException

public KernelRuntimeException(java.lang.String detail)
Construct an exception with only a detail message.

Parameters:
detail - The message.

KernelRuntimeException

public KernelRuntimeException(java.lang.Throwable cause,
 java.lang.String detail)
Construct an exception with a cause and a detail message.

Parameters:
cause - The cause of this exception.
detail - The message.

KernelRuntimeException

public KernelRuntimeException(Nameable object,
 java.lang.String detail)
Construct an exception with a detail message that includes the name of the first argument and the value of the second argument string.

Parameters:
object - The object.
detail - The message.

KernelRuntimeException

public KernelRuntimeException(Nameable object1,
 Nameable object2,
 java.lang.Throwable cause,
 java.lang.String detail)
Construct an exception with a detail message that includes the names of the first two arguments plus the value of the fourth argument string. If the cause argument is non-null, then the message of this exception will include the message of the cause argument. The stack trace of the cause argument is used when we print the stack trace of this exception. If one or more of the parameters are null, then the detail message is adjusted accordingly.

Parameters:
object1 - The first object.
object2 - The second object.
cause - The cause of this exception.
detail - The message.

KernelRuntimeException

public KernelRuntimeException(java.util.Collection objects,
 java.lang.Throwable cause,
 java.lang.String detail)
Construct an exception with a detail message that includes the names of a collection of Nameable objects plus the argument string.

Parameters:
objects - The Collection of Nameable objects
cause - The cause of this exception.
detail - The message.
Method Detail

getCause

public java.lang.Throwable getCause()
Get the cause of this exception.

Returns:
The cause that was passed in as an argument to the constructor, or null if no cause was specified.

getMessage

public java.lang.String getMessage()
Get the message of this exception. The message may have been adjusted if one of the constructor arguments was null, so the value returned by this method may not necessarily equal the value of the detail argument of of the constructor.

Returns:
The error message.

printStackTrace

public void printStackTrace()
Print a stack trace message to stderr including this exception, its stack trace and if the cause exception is known, print the cause exception and the cause stacktrace.


printStackTrace

public void printStackTrace(java.io.PrintStream printStream)
Print a stack trace message to printStream including this exception, its stack trace and if the cause exception is known, print the cause exception and the cause stacktrace.

Parameters:
printStream - The PrintStream to write to.

printStackTrace

public void printStackTrace(java.io.PrintWriter printWriter)
Print a stack trace message to printWriter including this exception, its stack trace and if the cause exception is known, print the cause exception and the cause stacktrace.

Parameters:
printWriter - The PrintWriter to write to.

_setCause

protected void _setCause(java.lang.Throwable cause)
Set the cause to the specified throwable.

Parameters:
cause - The cause of this exception

_setMessage

protected void _setMessage(java.lang.String message)
Sets the error message to the specified string. If the message argument is null, then the error message is set to the empty string.

Parameters:
message - The message.

Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

AltStyle によって変換されたページ (->オリジナル) /