org.apache.commons.configuration.event

Class ConfigurationErrorEvent

public class ConfigurationErrorEvent extends ConfigurationEvent

An event class that is used for reporting errors that occurred while processing configuration properties.

Some configuration implementations (e.g. DatabaseConfiguration or JNDIConfiguration use an underlying storage that can throw an exception on each property access. In earlier versions of this library such exceptions were logged and then silently ignored. This makes it impossible for a client to find out that something went wrong.

To give clients better control over the handling of errors that occur during access of a configuration object a new event listener mechanism specific for exceptions is introduced: Clients can register itself at a configuration object as an error listener and are then notified about all internal errors related to the source configuration object.

By inheriting from ConfigurationEvent this event class supports all properties that describe an operation on a configuration instance. In addition a Throwable object is available representing the occurred error. The event's type determines the operation that caused the error. Note that depending on the event type and the occurred exception not all of the other properties (e.g. name of the affected property or its value) may be available.

Since: 1.4

Version: $Id: ConfigurationErrorEvent.java 495926 2007-01-13 17:06:29Z oheger $

Author: Commons Configuration team

See Also: ConfigurationEvent

Field Summary
Throwablecause
Stores the exception that caused this event.
static longserialVersionUID
The serial version UID.
Constructor Summary
ConfigurationErrorEvent(Object source, int type, String propertyName, Object propertyValue, Throwable cause)
Creates a new instance of ConfigurationErrorEvent and initializes it.
Method Summary
ThrowablegetCause()
Returns the cause of this error event.

Field Detail

cause

private Throwable cause
Stores the exception that caused this event.

serialVersionUID

private static final long serialVersionUID
The serial version UID.

Constructor Detail

ConfigurationErrorEvent

public ConfigurationErrorEvent(Object source, int type, String propertyName, Object propertyValue, Throwable cause)
Creates a new instance of ConfigurationErrorEvent and initializes it.

Parameters: source the event source type the event's type propertyName the name of the affected property propertyValue the value of the affected property cause the exception object that caused this event

Method Detail

getCause

public Throwable getCause()
Returns the cause of this error event. This is the Throwable object that caused this event to be fired.

Returns: the cause of this error event