ch.elca.el4j.core.exceptions
Class BaseRTException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by ch.elca.el4j.core.exceptions.BaseRTException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbstractConditionRTException, ActionNotFoundException, MisconfigurationRTException, NoProtocolAvailableRTException

public class BaseRTException
extends RuntimeException

This is the parent runtime exception of all the runtime exceptions in EL4J. It provides a few functionalities, that may or may not be used by child exceptions:

Internationalizing exception messages can be performed (external to this class) with the help of the MessageSources of the spring framework. This class uses the exception wrapping mechanism of the java.lang.Exception class that was introduced with the JDK 1.4.

Author:
Alain Borlet-Hote (ABH), Philipp Oser (POS), Paul E. Sevinç (PES), Yves Martin (YMA), Martin Zeltner (MZE)
See Also:
For more information on the format for the parameter substitution, Serialized Form
File-location:
BaseRTException
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Field Summary
protected  String m_message
          Contains either the message of the exception or when message format is used, the messageFormat.
protected  Object[] m_messageFormatParameters
          The parameters to substitute.
 
Constructor Summary
BaseRTException(String message)
          Constructor with a message.
BaseRTException(String message, Object[] parameters)
          The constructor with a message in MessageFormat and parameters.
BaseRTException(String message, Object[] parameters, Throwable wrappedException)
          The constructor with a message in MessageFormat, with parameters, and with a wrapped exception (with all the formal parameters).
BaseRTException(String message, Throwable exception)
          Constructor with a message and an exception.
BaseRTException(Throwable exception)
          Constructor with an exception.
 
Method Summary
 Object[] getFormatParameters()
          Gets parameters defined for the message.
 String getFormatString()
          Returns the message pattern for MessageFormat or the message of the exception.
 String getMessage()
          Get the normal message for the exception.
 void setFormatString(String formatString)
          Sets a new format String.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_message

protected String m_message
Contains either the message of the exception or when message format is used, the messageFormat. MessageFormat substitution is applied if the result of getFormatParameters() is not null. The message field in the Throwable class is not used (rationale: it cannot be set without creating a new object).


m_messageFormatParameters

protected Object[] m_messageFormatParameters
The parameters to substitute. In subclasses, you may either use this Object[] to hold the messageFormatParameters or (typically preferred) define your own (typed and named) attributes that you need.

Constructor Detail

BaseRTException

public BaseRTException(String message,
                       Object[] parameters,
                       Throwable wrappedException)
The constructor with a message in MessageFormat, with parameters, and with a wrapped exception (with all the formal parameters).

Parameters:
message - the message of this exception
parameters - the parameters to substitute in the message
wrappedException - the exception that is wrapped in this exception

BaseRTException

public BaseRTException(String message,
                       Object[] parameters)
The constructor with a message in MessageFormat and parameters. No Throwable or Exception is transfered.

Parameters:
message - the message of this exception
parameters - the parameters to substitute in the message

BaseRTException

public BaseRTException(String message,
                       Throwable exception)
Constructor with a message and an exception.

Parameters:
message - the message of this exception
exception - the exception that is wrapped in this exception

BaseRTException

public BaseRTException(String message)
Constructor with a message.

Parameters:
message - the message of this exception

BaseRTException

public BaseRTException(Throwable exception)
Constructor with an exception.

Parameters:
exception - the exception that is wrapped in this exception
Method Detail

getFormatString

public String getFormatString()
Returns the message pattern for MessageFormat or the message of the exception.

Returns:
the message of this exception (without any parameters substituted in it).

setFormatString

public void setFormatString(String formatString)
Sets a new format String. It replaces the default formatString by an internationalized String.

Parameters:
formatString - replaces the message

getFormatParameters

public Object[] getFormatParameters()
Gets parameters defined for the message. This should be overridden if you have defined your own set of attributes.

Returns:
array of arguments for MessageFormat

getMessage

public String getMessage()
Get the normal message for the exception. Please override the Throwable.getLocalizedMessage() to automatically get the message particular for your Locale.

Overrides:
getMessage in class Throwable
Returns:
the message for the user (if necessary with the substituted parameters)


Copyright © 2005-2011 ELCA. All Rights Reserved.