List of usage examples for org.apache.commons.configuration2.ex ConfigurationException ConfigurationException
public ConfigurationException(final String message, final Throwable cause)
From source file:org.craftercms.commons.config.YamlConfiguration.java
@SuppressWarnings("unchecked") protected void load(Reader in) throws ConfigurationException { try {/*from w ww . j av a 2s. c o m*/ Yaml yaml = new Yaml(); Map<String, Object> yamlObj = yaml.loadAs(in, Map.class); logger.debug(LOG_KEY_YAML_LOADED, yamlObj); buildConfig(yamlObj); } catch (Exception e) { throw new ConfigurationException(I10nUtils .getLocalizedMessage(I10nUtils.DEFAULT_ERROR_MESSAGE_BUNDLE_NAME, ERROR_KEY_LOAD_ERROR), e); } }
From source file:org.craftercms.engine.util.ConfigUtils.java
public static XMLConfiguration readXmlConfiguration(Resource resource, char listDelimiter, Map<String, Lookup> prefixLookups) throws ConfigurationException { Parameters params = new Parameters(); FileBasedConfigurationBuilder<XMLConfiguration> builder = new FileBasedConfigurationBuilder<>( XMLConfiguration.class); try {/*from ww w. ja v a 2 s . co m*/ XMLBuilderParameters xmlParams = params.xml().setURL(resource.getURL()) .setListDelimiterHandler(new DefaultListDelimiterHandler(listDelimiter)); if (MapUtils.isNotEmpty(prefixLookups)) { xmlParams = xmlParams.setPrefixLookups(prefixLookups); } builder.configure(xmlParams); } catch (IOException e) { throw new ConfigurationException("Unable to get URL of resource " + resource, e); } return builder.getConfiguration(); }