Example usage for org.apache.commons.configuration.event ConfigurationErrorEvent getCause

List of usage examples for org.apache.commons.configuration.event ConfigurationErrorEvent getCause

Introduction

In this page you can find the example usage for org.apache.commons.configuration.event ConfigurationErrorEvent getCause.

Prototype

public Throwable getCause() 

Source Link

Document

Returns the cause of this error event.

Usage

From source file:gov.nih.nci.security.authentication.LockoutConfigurationListener.java

public void configurationError(ConfigurationErrorEvent event) {
    configurationChanged(event);
    event.getCause().printStackTrace();
}

From source file:com.jkoolcloud.tnt4j.repository.FileTokenRepository.java

@Override
public void configurationError(ConfigurationErrorEvent event) {
    logger.log(OpLevel.ERROR, "Configuration error detected, event={0}", event, event.getCause());
    repListener.repositoryError(new TokenRepositoryEvent(event.getSource(), TokenRepository.EVENT_EXCEPTION,
            event.getPropertyName(), event.getPropertyValue(), event.getCause()));
}

From source file:eu.scape_project.planning.utils.ConfigurationLoader.java

/**
 * Loads the configuration with the provided name.
 * //from ww  w  .  j a  v a 2 s.  co  m
 * @param name
 *            the configuration name
 * @param ignoreBuffer
 *            true to ignore the internal buffer, false otherwise
 * @return the configuration
 */
public Configuration load(String name, boolean ignoreBuffer) {
    CombinedConfiguration config = null;

    if (!ignoreBuffer) {
        config = buffer.get(name);
        if (config != null) {
            return config;
        }
    }

    try {
        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(name);
        builder.clearErrorListeners();
        builder.addErrorListener(new ConfigurationErrorListener() {
            @Override
            public void configurationError(ConfigurationErrorEvent event) {
                if (event.getType() == DefaultConfigurationBuilder.EVENT_ERR_LOAD_OPTIONAL) {
                    LOG.debug("Could not load optional configuration file {}", event.getPropertyName(),
                            event.getCause());
                } else {
                    LOG.warn("Configuration error on {}", event.getPropertyName(), event.getCause());
                }
            }
        });
        config = builder.getConfiguration(true);
        buffer.put(name, config);
    } catch (ConfigurationException e) {
        LOG.error("Cannot load configuration {}", e, name);
    }
    return config;
}