jess
Class JessException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjess.JessException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RuleCompilerException

public class JessException
extends java.lang.Exception
implements java.io.Serializable

JessException is the parent type of all exceptions thrown by public methods in the Jess library.

(C) 1997 Ernest J. Friedman-Hill and Sandia National Laboratories

Author:
Ernest J. Friedman-Hill
See Also:
Serialized Form

Constructor Summary
JessException(java.lang.String routine, java.lang.String msg, int data)
          Constructs a JessException containing a descriptive message.
JessException(java.lang.String routine, java.lang.String msg, java.lang.String data)
          Constructs a JessException containing a descriptive message.
JessException(java.lang.String routine, java.lang.String msg, java.lang.Throwable t)
          Constructs a JessException containing a nested exception.
 
Method Summary
 void addContext(java.lang.String s)
          Adds information about where an error happened to a JessException.
 java.lang.Throwable getCause()
          Get any nested exception object.
 java.lang.String getContext()
          Get the context information for this error.
 java.lang.String getData()
          Get the extra error data.
 int getLineNumber()
          Get the program line number where the error occurred.
 java.lang.String getMessage()
          Get the error message.
 java.lang.Throwable getNextException()
          Deprecated. Use getCause instead.
 java.lang.String getProgramText()
          Get the Jess program fragment that led to this exception
 java.lang.String getRoutine()
          Get the Java routine name where this error occurred
 void setData(java.lang.String v)
          Set the value of the extra error data.
 void setLineNumber(int v)
          Set the program line number where the error occurred.
 void setMessage(java.lang.String v)
          Set the error message.
 void setNextException(java.lang.Throwable v)
          Set a nested exception object
 void setProgramText(java.lang.String v)
          Set the Jess program fragment that led to this exception.
 void setRoutine(java.lang.String v)
          Set the Java routine name where this error occurred
 java.lang.String toString()
          Returns a String representation of this JessException.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JessException

public JessException(java.lang.String routine,
                     java.lang.String msg,
                     java.lang.String data)
Constructs a JessException containing a descriptive message. The three separate arguments make it easy to assemble a message from pieces.

Parameters:
routine - the name of the routine this exception occurred in.
msg - an informational message.
data - usually some data; appended to msg after a space.

JessException

public JessException(java.lang.String routine,
                     java.lang.String msg,
                     int data)
Constructs a JessException containing a descriptive message. The three separate arguments make it easy to assemble a message from pieces.

Parameters:
routine - the name of the routine this exception occurred in.
msg - an informational message.
data - usually some data; appended to msg after a space.

JessException

public JessException(java.lang.String routine,
                     java.lang.String msg,
                     java.lang.Throwable t)
Constructs a JessException containing a nested exception.

Parameters:
routine - the name of the routine this exception occurred in.
msg - an informational message.
t - another type of exception that this object wraps
Method Detail

getNextException

public java.lang.Throwable getNextException()
Deprecated. Use getCause instead.

Get any nested exception object.

Returns:
Value of nextException. Returns null if none.
See Also:
getCause()

getCause

public java.lang.Throwable getCause()
Get any nested exception object.

Returns:
Value of nextException. Returns null if none.

setNextException

public void setNextException(java.lang.Throwable v)
Set a nested exception object

Parameters:
v - Value to assign to nextException.

getLineNumber

public int getLineNumber()
Get the program line number where the error occurred.

Returns:
Value of lineNumber.

setLineNumber

public void setLineNumber(int v)
Set the program line number where the error occurred.

Parameters:
v - Value to assign to lineNumber.

getMessage

public java.lang.String getMessage()
Get the error message.

Returns:
Value of message.

setMessage

public void setMessage(java.lang.String v)
Set the error message.

Parameters:
v - Value to assign to message.

getRoutine

public java.lang.String getRoutine()
Get the Java routine name where this error occurred

Returns:
Value of routine.

setRoutine

public void setRoutine(java.lang.String v)
Set the Java routine name where this error occurred

Parameters:
v - Value to assign to routine.

getData

public java.lang.String getData()
Get the extra error data.

Returns:
Value of data.

setData

public void setData(java.lang.String v)
Set the value of the extra error data.

Parameters:
v - Value to assign to data.

getProgramText

public java.lang.String getProgramText()
Get the Jess program fragment that led to this exception

Returns:
Value of programText.

setProgramText

public void setProgramText(java.lang.String v)
Set the Jess program fragment that led to this exception.

Parameters:
v - Value to assign to programText.

addContext

public void addContext(java.lang.String s)
Adds information about where an error happened to a JessException. Contexts are tracked cumulatively, and the toString message will show all contexts that have been added.

Parameters:
s - a description of an execution context: 'defrule Foo', for example.
See Also:
toString()

getContext

public java.lang.String getContext()
Get the context information for this error.

Returns:
The context

toString

public java.lang.String toString()
Returns a String representation of this JessException. The String includes the routine name, message, and any contexts that have been added.

Returns:
a string containing this information.

© 2001 E.J. Friedman-Hill and Sandia Corporation