Example usage for org.apache.commons.configuration ConfigurationException getMessage

List of usage examples for org.apache.commons.configuration ConfigurationException getMessage

Introduction

In this page you can find the example usage for org.apache.commons.configuration ConfigurationException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.github.rnewson.couchdb.lucene.ConfigTest.java

@Test
public void testGetClient() {
    try {/* w ww  .  j  a  v  a  2s . c o m*/
        final Config config = new Config();
        HttpClient client = config.getClient();
        assertNotNull(client);
    } catch (ConfigurationException ce) {
        fail("ConfigurationException shouldn't have been thrown." + ce.getMessage());
    } catch (MalformedURLException mue) {
        fail("MalformedURLException shouldn't have been thrown." + mue.getMessage());
    }
}

From source file:com.github.rnewson.couchdb.lucene.ConfigTest.java

@Test
public void testGetDir() {
    try {/* ww  w . j a  v a 2 s  .  c  o m*/
        final Config config = new Config();
        File dir = config.getDir();
        assertTrue(dir.exists());
        assertTrue(dir.canRead());
        assertTrue(dir.canWrite());
        assertEquals(new File("target", "indexes"), dir);
    } catch (ConfigurationException ce) {
        fail("ConfigurationException shouldn't have been thrown." + ce.getMessage());
    } catch (IOException ioe) {
        fail("IOException shouldn't have been thrown." + ioe.getMessage());
    }
}

From source file:net.it_tim.dude_of_ping3.MultiThreadedTrapReceiver.java

public void processPdu(CommandResponderEvent event) {
    Thread t = Thread.currentThread();
    String name = t.getName();/* w  w  w  . j av  a  2  s.  c o  m*/
    PropertiesConfiguration dopConfig;
    String str, ping3_ip, host_ip = new String();
    long resetTime = 3000;

    str = event.getPDU().getVariableBindings().get(1).toString();
    System.out.println("Thread:" + name + " recieved trap:" + str);
    if (str.contains("=")) {
        int len = str.indexOf("=");
        str = str.substring(len + 2, str.length());
    }
    System.out.println("After substr: " + str);
    ping3_ip = event.getPeerAddress().toString().split("/")[0];
    System.out.println("Trap from IP: " + ping3_ip);

    try {
        dopConfig = new PropertiesConfiguration("dop.properties");
        host_ip = dopConfig.getString(ping3_ip, "127.0.0.1");
        resetTime = dopConfig.getLong("reset.time", 3000);
    } catch (ConfigurationException e2) {
        System.out.println(e2.getMessage());
    }
    System.out.println("Host IP: " + host_ip);
    if (str.equals("1.3.6.1.4.1.35160.1.0.12")) {
        System.out.println("Power on trap!");
        try {
            Ping ping = new Ping(host_ip, 500, (short) 100);
            System.out.println("Ping status:" + ping.isOnline());
            if (!ping.isOnline()) {
                System.out.println("Setting always off mode on: " + ping3_ip);
                Server.snmpSet(ping3_ip, "public", "1.3.6.1.4.1.35160.1.11.1.4.1", 1);
                Thread.sleep(resetTime);
                System.out.println("Setting always on mode on: " + ping3_ip);
                Server.snmpSet(ping3_ip, "public", "1.3.6.1.4.1.35160.1.11.1.4.1", 0);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}

From source file:ch.admin.suis.msghandler.common.ClientConfigurationFactoryTest.java

public void testCreateConfig1() throws ConfigurationException {
    // Just test the configuration
    new ClientConfigurationFactory("./src/test/resources/complete/mh/install-dir/conf/config.xml").init();

    try {//from ww  w.j ava2s. com
        new ClientConfigurationFactory(
                "./src/test/resources/complete/mh/install-dir/conf/config-doublication1.xml").init();
        fail();
    } catch (ConfigurationException ex) {
        assertTrue(ex.getMessage().contains("XML doublication"));
    }

    try {
        new ClientConfigurationFactory(
                "./src/test/resources/complete/mh/install-dir/conf/config-invalidpath.xml").init();
        fail();
    } catch (ConfigurationException ex) {
        assertTrue(ex.getMessage().contains("signingOutbox1_1_NOT_EXIST"));
    }
}

From source file:com.twitter.distributedlog.service.DistributedLogServerApp.java

private void run() {
    try {/*from ww w . j  a va 2s  . c  om*/
        logger.info("Running distributedlog server : args = {}", Arrays.toString(args));
        BasicParser parser = new BasicParser();
        CommandLine cmdline = parser.parse(options, args);
        runCmd(cmdline);
    } catch (ParseException pe) {
        logger.error("Argument error : {}", pe.getMessage());
        printUsage();
        Runtime.getRuntime().exit(-1);
    } catch (IllegalArgumentException iae) {
        logger.error("Argument error : {}", iae.getMessage());
        printUsage();
        Runtime.getRuntime().exit(-1);
    } catch (ConfigurationException ce) {
        logger.error("Configuration error : {}", ce.getMessage());
        printUsage();
        Runtime.getRuntime().exit(-1);
    } catch (IOException ie) {
        logger.error("Failed to start distributedlog server : ", ie);
        Runtime.getRuntime().exit(-1);
    }
}

From source file:at.co.malli.relpm.data.SettingsProvider.java

/**
 * Sets up the object. This is only called one time when getInstance() is called the first time.
 *//*from   ww  w . j  a  v a 2  s  . co m*/
public SettingsProvider() {
    try {
        defaults = new XMLConfiguration(defaultsFilename);
        user = new XMLConfiguration(userconfigFilename);
    } catch (ConfigurationException ex) {
        if (ex.getMessage().equals("Cannot locate configuration source " + userconfigFilename)) {
            logger.trace(userconfigFilename + " not found... Creating default...");
            createDefaultConfig();
        } else {
            logger.error(ex.getMessage());
            ExceptionDisplayer.showErrorMessage(ex);
        }
    }
    config.addConfiguration(user, true);
    config.addConfiguration(defaults, false);
}

From source file:ch.admin.suis.msghandler.common.ClientConfigurationFactoryTest.java

/**
 * Test following case: There's a normal sender available. Application like eSchKG or similar. In this case a
 * participantIdResolver has to be present.
 *///w w w .j  a  v  a 2s  .  c o  m
public void testCreateConfig2() {
    try {
        new ClientConfigurationFactory(
                "./src/test/resources/complete/mh/install-dir/conf/config-invalidMissingIdResolver.xml").init();
        fail();
    } catch (ConfigurationException ex) {
        assertTrue(
                ex.getMessage().contains("participiantResolverXYZ.groovy either not exist or is not a file"));
    }
}

From source file:at.co.malli.relpm.data.SettingsProvider.java

/**
 * Set up the default configuration in memory.
 *//*w w w  .j ava2  s  . c o m*/
private void createDefaultConfig() {
    user = new XMLConfiguration();

    Iterator<String> i = defaults.getKeys();
    while (i.hasNext()) {
        String key = i.next();
        Object value = defaults.getProperty(key);
        user.setProperty(key, value);
    }
    try {
        user.save(userconfigFilename);
    } catch (ConfigurationException ex) {
        logger.error(ex.getMessage());
        ExceptionDisplayer.showErrorMessage(ex);
    }
}

From source file:com.abiquo.abicloud.model.config.ConfigurationManager.java

public ConfigurationManager() {
    configuration = new Configuration();
    try {//from   ww  w .  j  a va  2  s .co  m
        loadXML();
    } catch (ConfigurationException e) {
        logger.error("An configuration erro was occured: {}", e.getMessage());
    }
}

From source file:com.nokia.ant.taskdefs.AntConfigurationTask.java

private void importFile(final File file) {
    try {/*  w  ww  . j  a  v  a2 s .  co  m*/
        String filename = file.getName();
        Configuration config = null;
        if (filename.endsWith(".txt")) {
            config = new PropertiesConfiguration(file);
        } else if (filename.endsWith(".xml")) {
            config = new XMLConfiguration(file);
        }
        Iterator keysIter = config.getKeys();
        while (keysIter.hasNext()) {
            String key = (String) keysIter.next();
            getProject().setProperty(key, config.getString(key));
        }
    } catch (ConfigurationException e) {
        throw new BuildException("Not able to import the ANT file " + e.getMessage());
    }
}