|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
ptolemy.kernel.util.KernelException
public class KernelException
Base class for Ptolemy exceptions. This class extends the basic JavaException with a constructor that can take a Nameable as an argument. (Note however, that it is better to use a class derived from KernelException than it is to throw a KernelException directly.)
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.
In this implementation, we have the following differences from the JDK1.4 exception chaining implementation:
KernelRuntimeException
,
Serialized Form
Green (cxh) |
Green (cxh) |
Field Summary | |
---|---|
private java.lang.Throwable |
_cause
|
private java.lang.String |
_message
|
private Nameable |
_object1
|
private Nameable |
_object2
|
Constructor Summary | |
---|---|
KernelException()
Construct an exception with a no specific detail message. |
|
KernelException(Nameable object1,
Nameable object2,
java.lang.String detail)
Construct an exception with a detail message that includes the names of the first two arguments plus the third argument string. |
|
KernelException(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 third argument string. |
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. |
static java.lang.String |
generateMessage(java.util.Collection objects,
java.lang.Throwable cause,
java.lang.String detail)
Generate a properly formatted exception message where the origin of the error is a collection. |
static java.lang.String |
generateMessage(Nameable object1,
Nameable object2,
java.lang.Throwable cause,
java.lang.String detail)
Generate a properly formatted exception message. |
static java.lang.String |
generateMessage(java.lang.String whereString,
java.lang.Throwable cause,
java.lang.String detail)
Generate a properly formatted detail message. |
java.lang.Throwable |
getCause()
Get the cause of this exception. |
static java.lang.String |
getFullName(Nameable object)
Get the name of a Nameable object. |
java.lang.String |
getMessage()
Get the message of this exception. |
static java.lang.String |
getName(Nameable object)
Get the name of a Nameable object. |
Nameable |
getNameable1()
Get the first Nameable, if any, that was passed as an argument. |
Nameable |
getNameable2()
Get the second Nameable, if any, that was passed as an argument. |
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. |
static java.lang.String |
stackTraceToString(java.lang.Throwable throwable)
Return the stack trace of the given argument as a String. |
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 |
Field Detail |
---|
private java.lang.String _message
private transient Nameable _object1
private transient Nameable _object2
private java.lang.Throwable _cause
Constructor Detail |
---|
public KernelException()
public KernelException(Nameable object1, Nameable object2, java.lang.String detail)
object1
- The first object.object2
- The second object.detail
- The message.public KernelException(Nameable object1, Nameable object2, java.lang.Throwable cause, java.lang.String detail)
object1
- The first object.object2
- The second object.cause
- The cause of this exception.detail
- The message.Method Detail |
---|
public static java.lang.String generateMessage(Nameable object1, Nameable object2, java.lang.Throwable cause, java.lang.String detail)
This method is public static so that both KernelException and KernelRuntimeException and any classes derived from those classes can use it. KernelRuntimeException must extend RuntimeException so that the java compiler will allow methods that throw KernelRuntimeException to not declare that they throw it, and KernelException cannot extend RuntimeException for the same reason.
object1
- The first object.object2
- The second object.cause
- The cause of this exception.detail
- The detail message.
public static java.lang.String generateMessage(java.util.Collection objects, java.lang.Throwable cause, java.lang.String detail)
This method is public static so that both KernelException and KernelRuntimeException and any classes derived from those classes can use it. KernelRuntimeException must extend RuntimeException so that the java compiler will allow methods that throw KernelRuntimeException to not declare that they throw it, and KernelException cannot extend RuntimeException for the same reason.
objects
- The where objects.cause
- The cause of this exception.detail
- The detail message.
public static java.lang.String generateMessage(java.lang.String whereString, java.lang.Throwable cause, java.lang.String detail)
This method is public static so that both KernelException and KernelRuntimeException and any classes derived from those classes can use it. KernelRuntimeException must extend RuntimeException so that the java compiler will allow methods that throw KernelRuntimeException to not declare that they throw it, and KernelException cannot extend RuntimeException for the same reason.
whereString
- The string that identifies where the error occurred,
as in for example "in object: foo".cause
- The cause of this exception.detail
- The message.
public java.lang.Throwable getCause()
getCause
in class java.lang.Throwable
public static java.lang.String getFullName(Nameable object)
This method is public static so that both KernelException and KernelRuntimeException and any classes derived from those classes can use it. KernelRuntimeException must extend RuntimeException so that the java compiler will allow methods that throw KernelRuntimeException to not declare that they throw it, and KernelException cannot extend RuntimeException for the same reason.
object
- An object with a full name.
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public static java.lang.String getName(Nameable object)
object
- An object with a name.
public Nameable getNameable1()
public Nameable getNameable2()
public void printStackTrace()
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream printStream)
printStackTrace
in class java.lang.Throwable
printStream
- The PrintStream to write to.public void printStackTrace(java.io.PrintWriter printWriter)
printStackTrace
in class java.lang.Throwable
printWriter
- The PrintWriter to write to.public static java.lang.String stackTraceToString(java.lang.Throwable throwable)
throwable
- A throwable.
protected void _setCause(java.lang.Throwable cause)
cause
- The cause of this exceptionprotected void _setMessage(java.lang.String message)
message
- The message.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |