List of usage examples for org.apache.commons.configuration ConfigurationException getMessage
public String getMessage()
From source file:org.apache.marmotta.platform.user.services.UserConfigurationServiceImpl.java
public void save(UserAccount user) { Configuration userConfig = getUserConfiguration(user); if (userConfig instanceof PropertiesConfiguration) { try {//from w ww .java 2 s .co m ((PropertiesConfiguration) userConfig).save(); } catch (ConfigurationException e) { log.error("could not save user configuration for user #0: #1", user.getLogin(), e.getMessage()); } } }
From source file:org.apache.qpid.server.configuration.plugins.AbstractConfigurationTest.java
public void testContainsPositiveLong() { assertTrue("positiveLong is not positive", _plugin.containsPositiveLong("positiveLong")); assertFalse("NonExistentValue was found", _plugin.containsPositiveLong("NonExistentValue")); try {/*from w w w . java 2s .c o m*/ _plugin.validatePositiveLong("positiveLong"); } catch (ConfigurationException e) { fail(e.getMessage()); } try { _plugin.validatePositiveLong("negativeLong"); fail("negativeLong should not be positive"); } catch (ConfigurationException e) { assertEquals("negativeLong should not be reported as positive", "TestConfigPlugin: unable to configure invalid negativeLong:" + NEGATIVE_LONG, e.getMessage()); } }
From source file:org.apache.qpid.server.configuration.VirtualHostConfigurationTest.java
/** * Tests that the old element security.authentication.name is rejected. This element * was never supported properly as authentication is performed before the virtual host * is considered./*from w w w . ja v a 2 s.c o m*/ */ public void testSecurityAuthenticationNameRejected() throws Exception { getConfigXml().addProperty( "virtualhosts.virtualhost.testSecurityAuthenticationNameRejected.security.authentication.name", "testdb"); try { createVirtualHost(getName()); fail("Exception not thrown"); } catch (ConfigurationException ce) { assertEquals("Incorrect error message", "Validation error : security/authentication/name is no longer a supported element within the configuration xml." + " It appears in virtual host definition : " + getName(), ce.getMessage()); } }
From source file:org.apache.qpid.server.configuration.VirtualHostConfigurationTest.java
public void testExpiredMessageCheckPeriodRejected() throws Exception { getConfigXml().addProperty(/*from www . j a va 2s . co m*/ "virtualhosts.virtualhost.testExpiredMessageCheckPeriodRejected.housekeeping.expiredMessageCheckPeriod", 5); try { createVirtualHost(getName()); fail("Exception not thrown"); } catch (ConfigurationException ce) { assertEquals("Incorrect error message", "Validation error : housekeeping/expiredMessageCheckPeriod must be replaced by housekeeping/checkPeriod." + " It appears in virtual host definition : " + getName(), ce.getMessage()); } }
From source file:org.apache.qpid.server.store.berkeleydb.HAMessageStoreSmokeTest.java
public void testMissingHAConfigThrowsException() throws Exception { try {//w w w . j a va 2s .c o m _store.configure("test", _config); fail("Expected an exception to be thrown"); } catch (ConfigurationException ce) { assertTrue(ce.getMessage().contains("BDB HA configuration key not found")); } }
From source file:org.apache.tajo.util.metrics.TajoSystemMetrics.java
public TajoSystemMetrics(TajoConf tajoConf, Class clazz, String hostAndPort) { super(MetricsUtil.getGroupName(clazz)); this.hostAndPort = hostAndPort; try {//from w w w. j ava2s .c o m this.metricsPropertyFileName = tajoConf.getVar(TajoConf.ConfVars.METRICS_PROPERTY_FILENAME); this.metricsProps = new PropertiesConfiguration(metricsPropertyFileName); this.metricsProps.addConfigurationListener(new MetricsReloadListener()); FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy(); reloadingStrategy.setRefreshDelay(5 * 1000); this.metricsProps.setReloadingStrategy(reloadingStrategy); } catch (ConfigurationException e) { LOG.warn(e.getMessage(), e); } // PropertiesConfiguration fire configurationChanged after getXXX() // So neeaded calling getXXX periodically propertyChangeChecker = new Thread() { public void run() { while (!stop.get()) { String value = metricsProps.getString("reporter.file"); try { Thread.sleep(10 * 1000); } catch (InterruptedException e) { } } } }; propertyChangeChecker.start(); }
From source file:org.apache.whirr.karaf.command.support.ConfigurationReader.java
/** * Builds Configuration from a File./*w w w.j av a2s .co m*/ * * @param fileName * @return * @throws org.apache.commons.configuration.ConfigurationException * */ public static PropertiesConfiguration fromFile(String fileName) { PropertiesConfiguration config = null; try { config = new PropertiesConfiguration(fileName); } catch (ConfigurationException e) { System.err.println( String.format("Failed to read configuration from file:%s.%s.", fileName, e.getMessage())); } return config; }
From source file:org.apache.ws.scout.registry.ConnectionImpl.java
public ConnectionImpl(Properties properties) throws InvalidRequestException { postalScheme = properties.getProperty(ConnectionFactoryImpl.POSTALADDRESSSCHEME_PROPERTY); String val = properties.getProperty(ConnectionFactoryImpl.MAXROWS_PROPERTY); maxRows = (val == null) ? -1 : Integer.valueOf(val); uddiVersion = properties.getProperty(ConnectionFactoryImpl.UDDI_VERSION_PROPERTY, DEFAULT_UDDI_VERSION); //The TCK does not set the UDDI_VERSION, so if the lifecycle URL contains 'v3' we //automagically set the version to be "3.0" if (!properties.contains(ConnectionFactoryImpl.UDDI_VERSION_PROPERTY) && (properties.contains(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY)) && properties.getProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY).contains("v3")) { properties.setProperty(ConnectionFactoryImpl.UDDI_VERSION_PROPERTY, "3.0"); uddiVersion = "3.0"; String securityManager = properties.getProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY) .replace("publish", "security"); properties.setProperty(ConnectionFactoryImpl.SECURITYMANAGER_PROPERTY, securityManager); }/*from ww w.j a v a 2 s. com*/ String uddiConfigFile = properties.getProperty(JUDDI_CLIENT_CONFIG_FILE);// DEFAULT_JUDDI_CLIENT_CONFIG_FILE); if (isUDDIv3(uddiVersion)) { String nodeName = null; String managerName = null; if (manager == null && uddiConfigFile != null) { try { manager = new UDDIClerkManager(uddiConfigFile, properties); manager.start(); } catch (ConfigurationException e) { log.error(e.getMessage(), e); } } if (manager != null) { try { managerName = manager.getName(); nodeName = manager.getClientConfig().getHomeNode().getName(); } catch (ConfigurationException e) { log.error(e.getMessage(), e); } } registry = new RegistryV3Impl(properties, nodeName, managerName); } else { registry = new RegistryImpl(properties); } //this.postalScheme = postalScheme; //this.maxRows = maxRows; }
From source file:org.codice.alliance.distribution.branding.AllianceBrandingPlugin.java
public void init() { try {//from w w w .j av a 2 s . c o m PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration( getClass().getResource(brandingPropertiesFilePath)); productName = propertiesConfiguration.getString("branding.product.name", "Alliance"); productURL = propertiesConfiguration.getString("branding.product.url", "https://github.com/codice/alliance"); productImage = propertiesConfiguration.getString("branding.product.image", "/alliance/alliance-logo.png"); vendorName = propertiesConfiguration.getString("branding.vendor.name", "Codice Foundation"); vendorURL = propertiesConfiguration.getString("branding.vendor.url", "http://codice.org"); vendorImage = propertiesConfiguration.getString("branding.vendor.image", "/alliance/alliance-logo.png"); favIcon = propertiesConfiguration.getString("branding.favicon", "/alliance/favicon.ico"); } catch (ConfigurationException e) { LOGGER.error("Unable to read properties file {}", brandingPropertiesFilePath, e.getMessage()); productName = "Alliance"; productURL = "https://github.com/codice/alliance"; productImage = "/alliance/alliance-logo.png"; vendorName = "Codice Foundation"; vendorURL = "https://github.com/codice/alliance"; vendorImage = "/alliance/alliance-logo.png"; favIcon = "/alliance/favicon.ico"; } }
From source file:org.codice.ddf.branding.impl.DdfBrandingPlugin.java
public void init() { try {//from w w w. j a v a 2 s .c o m PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration( getClass().getResource(brandingPropertiesFilePath)); productName = propertiesConfiguration.getString("branding.product.name", "DDF"); productURL = propertiesConfiguration.getString("branding.product.url", "http://codice.org/ddf"); productImage = propertiesConfiguration.getString("branding.product.image", "/ddf/ddf.png"); vendorName = propertiesConfiguration.getString("branding.vendor.name", "Codice"); vendorURL = propertiesConfiguration.getString("branding.vendor.url", "http://codice.org"); vendorImage = propertiesConfiguration.getString("branding.vendor.image", "/ddf/logo.png"); favIcon = propertiesConfiguration.getString("branding.favicon", "/ddf/favicon.png"); } catch (ConfigurationException e) { LOGGER.info("Unable to read properties file {}", brandingPropertiesFilePath, e.getMessage()); productName = "DDF"; productURL = "http://codice.org/ddf"; productImage = "/ddf/ddf.png"; vendorName = "Codice"; vendorURL = "http://codice.org"; vendorImage = "/ddf/logo.png"; favIcon = "/ddf/favicon.png"; } }