List of usage examples for org.apache.commons.configuration DefaultConfigurationBuilder EVENT_ERR_LOAD_OPTIONAL
int EVENT_ERR_LOAD_OPTIONAL
To view the source code for org.apache.commons.configuration DefaultConfigurationBuilder EVENT_ERR_LOAD_OPTIONAL.
Click Source Link
From source file:eu.scape_project.planning.utils.ConfigurationLoader.java
/** * Loads the configuration with the provided name. * // www. j a v a 2 s. c o 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; }