org.eclipse.hyades.logging.events.cbe
Class EventException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.eclipse.hyades.logging.events.cbe.EventException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CompletionException, FormattingException, ValidationException

public class EventException
extends java.lang.Exception

Base for all exceptions in CBE package. The EventException class is a subclass of java.lang.Exception that provides support for exception chaining semantics for pre-JDK v1.4 run-times.

It should be noted that this class provides only the exception chaining semantics available in JDK v1.4 which is a subset of new exception functionality introduced in JDK v1.4. Most of the new functionality requires support from the JVM that is not available on earlier run-times.

Exceptions that subclass this exception only need to add the various constructors and inherit everything else from this class.

See the API documentation for java.lang.Throwable in JDK v1.4 for a full description of the exception chaining functionality.

EventException also provides support for localized (language-specific) messages.

A EventException contains the following components:

Since:
1.0.1
Version:
1.0.1
Author:
Denilson Nastacio, Paul E. Slauenwhite
See Also:
Exception, Serialized Form

Field Summary
protected  java.lang.String key
          The key of the message associated with this text.
protected  java.lang.Object[] parameters
          Parameters to be included in the message.
protected  java.lang.String resourceBundleName
          Base name of the ResourceBundle in which the text is found.
 
Constructor Summary
EventException()
          Construct a new EventException with a null detail message and an uninitialized cause field.
EventException(java.lang.String message)
          Construct a new EventException with the specified detail message and an uninitialized cause field.
EventException(java.lang.String key, java.lang.String resourceBundleName)
          Creates a EventException with a detail message, message translation information (resource bundle, message key and message substitutions).
EventException(java.lang.String key, java.lang.String resourceBundleName, java.lang.Object[] parameters)
          Creates a EventException with a detail message, message translation information (resource bundle, message key and message substitutions).
EventException(java.lang.String key, java.lang.String resourceBundleName, java.lang.Object[] parameters, java.lang.Throwable cause)
          Creates a EventException with a detail message, message translation information (resource bundle, message key and message substitutions) and a nested exception.
EventException(java.lang.String message, java.lang.Throwable cause)
          Construct a new EventException with a null detail message and a cause field set to the specified Throwable.
EventException(java.lang.Throwable cause)
          Construct a new EventException with a null detail message and a cause field set to the specified Throwable.
 
Method Summary
 java.lang.Throwable getCause()
          Return the Throwable that is considered the root cause of this EventException.
 java.lang.String getKey()
          Gets the message key.
 java.lang.String getLocalizedMessage()
          Gets the text of the exception message, translated into the current locale.
 java.lang.String getLocalizedMessage(java.util.Locale locale)
          Gets the text of the exception message, translated into the specified locale.
 java.lang.String getMessage()
          Gets the text of the exception message.
 java.lang.Throwable initCause(java.lang.Throwable cause)
          Initialize the cause field for this EventException to the specified value.
 void printStackTrace()
          Print this EventException and its backtrace to System.err.
 void printStackTrace(java.io.PrintStream stream)
          Print this EventException and its backtrace to the specified print stream.
 void printStackTrace(java.io.PrintWriter writer)
          Print this EventException and its backtrace to the specified print writer.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resourceBundleName

protected java.lang.String resourceBundleName
Base name of the ResourceBundle in which the text is found.


key

protected java.lang.String key
The key of the message associated with this text.


parameters

protected java.lang.Object[] parameters
Parameters to be included in the message.

Constructor Detail

EventException

public EventException()
Construct a new EventException with a null detail message and an uninitialized cause field. The cause may subsequently be initialized via calling the initCause(java.lang.Throwable) method.


EventException

public EventException(java.lang.String message)
Construct a new EventException with the specified detail message and an uninitialized cause field. The cause may subsequently be initialized via calling the initCause(java.lang.Throwable) method.

Parameters:
message - a detail message. Null is tolerated.

EventException

public EventException(java.lang.String key,
                      java.lang.String resourceBundleName)
Creates a EventException with a detail message, message translation information (resource bundle, message key and message substitutions).

Parameters:
key - The message key.
resourceBundleName - The name of the message ResourceBundle to use.

EventException

public EventException(java.lang.Throwable cause)
Construct a new EventException with a null detail message and a cause field set to the specified Throwable. Subsequent calls to the initCause(java.lang.Throwable) method on this instance will result in an exception. The value of the cause field may be retrieved at any time via the getCause() method.

Parameters:
cause - the Throwable that was caught and is considered the root cause of this exception. Null is tolerated.

EventException

public EventException(java.lang.String message,
                      java.lang.Throwable cause)
Construct a new EventException with a null detail message and a cause field set to the specified Throwable. Subsequent calls to the initCause(java.lang.Throwable) method on this instance will result in an exception. The value of the cause field may be retrieved at any time via the getCause() method.

Parameters:
message - the detail message. Null is tolerated.
cause - the Throwable that was caught and is considered the root cause of this exception. Null is tolerated.

EventException

public EventException(java.lang.String key,
                      java.lang.String resourceBundleName,
                      java.lang.Object[] parameters)
Creates a EventException with a detail message, message translation information (resource bundle, message key and message substitutions).

Parameters:
key - The message key.
resourceBundleName - The name of the message ResourceBundle to use.
parameters - An array of elements to be inserted into the message.

EventException

public EventException(java.lang.String key,
                      java.lang.String resourceBundleName,
                      java.lang.Object[] parameters,
                      java.lang.Throwable cause)
Creates a EventException with a detail message, message translation information (resource bundle, message key and message substitutions) and a nested exception.

Parameters:
key - The message key.
resourceBundleName - The name of the message ResourceBundle to use.
parameters - An array of elements to be inserted into the message.
cause - The nested exception, or null, if a nested exception is not appropriate.
Method Detail

getCause

public java.lang.Throwable getCause()
Return the Throwable that is considered the root cause of this EventException. Null is returned if the root cause is nonexistent or unknown. The root cause is the throwable that caused this EventException to get thrown.

The Throwable that is returned is either the Throwable supplied via one of the appropriate constructors, or that set via the initCause(Throwable) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means, such as a legacy exception chaining infrastructure.

Overrides:
getCause in class java.lang.Throwable
Returns:
the Throwable that is the cause of this EventException, or null if the cause is nonexistent or unknown.

getKey

public java.lang.String getKey()
Gets the message key. The result is the key of the message associated with this text.

Returns:
String The message key .

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Gets the text of the exception message, translated into the current locale.

Overrides:
getLocalizedMessage in class java.lang.Throwable
Returns:
The localized exception message.

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.util.Locale locale)
Gets the text of the exception message, translated into the specified locale.

Parameters:
locale - The locale to use for translation of the exception message, or null to use the default locale.
Returns:
The localized exception message.

getMessage

public java.lang.String getMessage()
Gets the text of the exception message. The result is the same as that returned by getLocalizedMessage(Locale.ENGLISH).

Overrides:
getMessage in class java.lang.Throwable
Returns:
The exception message.

initCause

public java.lang.Throwable initCause(java.lang.Throwable cause)
                              throws java.lang.IllegalStateException,
                                     java.lang.IllegalArgumentException
Initialize the cause field for this EventException to the specified value. The cause is the Throwable that caused this EventException to get thrown.

This method can be called at most once. It is generally called from within a constructor that takes a Throwable, or immediately after constructing this object with a constructor that does not accept a Throwable. Thus, if a constructor that takes Throwable as a parameter is used to construct this object, it cannot be called at all.

Overrides:
initCause in class java.lang.Throwable
Parameters:
cause - the Throwable which caused this EventException to be thrown. Null is tolerated.
Returns:
a reference to this Throwable instance.
Throws:
java.lang.IllegalStateException - if this EventException was created with a constructor that specified a cause, or this method has already been called on this object.
java.lang.IllegalArgumentException - if the specified cause is this EventException. An exception cannot be its own cause.

printStackTrace

public void printStackTrace()
Print this EventException and its backtrace to System.err.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream stream)
Print this EventException and its backtrace to the specified print stream.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
stream - the PrintStream to use for output

printStackTrace

public void printStackTrace(java.io.PrintWriter writer)
Print this EventException and its backtrace to the specified print writer.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
writer - the PrintWriter to use for output