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.wet.wired.jsr.recorder.DesktopScreenRecorder.java

public DesktopScreenRecorder(OutputStream oStream, ScreenRecorderListener listener, String sessionId) {
    super(oStream, listener);

    BasicConfigurator.configure();/*from w  w w  .  j a v a2s .co  m*/

    if (sessionId == null) {
        sessionId = UUID.randomUUID().toString();
    }

    try {
        Idioma idioma = new Idioma();
        logger.trace("Set Idioma:start()");
        config = idioma.setIdioma("espanol");
        logger.trace("Set Idioma:end()");
    } catch (ConfigurationException e2) {
        logger.error(e2.getMessage());
    }

    LoggerUtils loggerUtils = new LoggerUtils();

    loggerUtils.load(config.getString("pathGlobal"), sessionId, config.getString("synchronizer.ruta.log"),
            config.getString("pathLog4j"), "synchronizer.log", "synchronizer.html");

    logger.info("****************** Inicio de Screen Recorder ***************** ");
    logger.info("*********** " + sessionId + " *********** ");
    logger.info("************************************************************ ");

    try {
        String mouseCursorFile;

        if (useWhiteCursor)
            mouseCursorFile = "white_cursor.png";
        else
            mouseCursorFile = "black_cursor.png";

        URL cursorURL = getClass().getResource("/mouse_cursors/" + mouseCursorFile);

        mouseCursor = ImageIO.read(cursorURL);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:it.imtech.bookimporter.BookUtilityTest.java

/**
 * Test of getOrderedLanguages method, of class BookUtility.
 *///from w ww  . ja  v  a2  s  . c  o  m
public void testGetOrderedLanguages() {
    System.out.println("Test Ordering configuration languages: method -> getOrderedLanguages");
    TreeMap<String, String> en = new TreeMap<String, String>();
    en.put("English", "en");
    en.put("German", "de");
    en.put("Italian", "it");

    TreeMap<String, String> it = new TreeMap<String, String>();
    it.put("Inglese", "en");
    it.put("Italiano", "it");
    it.put("Tedesco", "de");

    TreeMap<String, String> de = new TreeMap<String, String>();
    de.put("Deutsch", "de");
    de.put("English", "en");
    de.put("Italienisch", "it");

    try {
        CustomClassLoader loader = new CustomClassLoader();

        Locale locale = new Locale("en");
        ResourceBundle bundle = ResourceBundle.getBundle(RESOURCES, locale, loader);
        XMLConfiguration config = new XMLConfiguration(new File(DEBUG_XML));
        TreeMap<String, String> result = BookUtility.getOrderedLanguages(config, bundle);
        assertEquals(en, result);

        locale = new Locale("it");
        bundle = ResourceBundle.getBundle(RESOURCES, locale, loader);
        config = new XMLConfiguration(new File(DEBUG_XML));
        result = BookUtility.getOrderedLanguages(config, bundle);
        assertEquals(it, result);

        locale = new Locale("de");
        bundle = ResourceBundle.getBundle(RESOURCES, locale, loader);
        config = new XMLConfiguration(new File(DEBUG_XML));
        result = BookUtility.getOrderedLanguages(config, bundle);
        assertEquals(de, result);
    } catch (ConfigurationException e) {
        fail("Ordering Language Test failed: ConfigurationException:- " + e.getMessage());
    }
}

From source file:com.dcsquare.hivemq.plugin.fileauthentication.FileAuthenticationModule.java

/**
 * Creates properties configuration for fileAuthConfiguration.properties
 * <p/>//from w ww.  j  a  v  a2s.c  om
 * It was extracted for being able to override it in the test cases.
 *
 * @return PropertiesConfiguration of configuration file fileAuthConfiguration.properties
 */
@VisibleForTesting
PropertiesConfiguration getPluginConfiguration() {
    PropertiesConfiguration fileAuthConfiguration = null;

    final File file = new File(getPluginFolder(), "fileAuthConfiguration.properties");
    if (!file.exists()) {
        throw new ConfigurationFileNotFoundException(
                "fileAuthConfiguration.properties was not found in plugin folder:"
                        + getPluginFolder().getAbsolutePath());
    }
    try {
        fileAuthConfiguration = new PropertiesConfiguration(file);
    } catch (ConfigurationException e) {
        throw new ConfigurationInitializationException(e.getMessage());
    }
    return fileAuthConfiguration;
}

From source file:com.yahoo.glimmer.indexing.generator.Index.java

public void close(long writtenOccurrences) throws IOException {
    try {//from  w  w w. j av a2 s.  c om
        Properties props = indexWriter.properties();
        System.out.println("Closing index " + name + " which has "
                + props.getProperty(it.unimi.di.big.mg4j.index.Index.PropertyKeys.TERMS) + " terms ");
        if (positions) {
            props.setProperty(it.unimi.di.big.mg4j.index.Index.PropertyKeys.OCCURRENCES, writtenOccurrences);
        }
        props.setProperty(it.unimi.di.big.mg4j.index.Index.PropertyKeys.MAXCOUNT, -1);
        props.setProperty(it.unimi.di.big.mg4j.index.Index.PropertyKeys.FIELD, name);
        props.setProperty(it.unimi.di.big.mg4j.index.Index.PropertyKeys.TERMPROCESSOR,
                CombinedTermProcessor.getInstance());
        props.addProperty(ResourceRefTermProcessor.PropertyKeys.REF_PREFIX, hashValuePrefix);

        props.save(properties);
    } catch (ConfigurationException e) {
        throw new IOException(e.getMessage());
    }

    properties.close();

    if (docSizes != null) {
        for (; docSizesLastDocument < numDocs; docSizesLastDocument++) {
            docSizes.writeGamma(0);
        }
        docSizes.close();
    }

    terms.close();
    indexWriter.close();
}

From source file:com.oprisnik.semdroid.config.XmlConfig.java

public XmlConfig(File file) throws BadConfigException, FileNotFoundException {
    try {/*from   w w  w  . j av  a  2 s.  c  o  m*/
        if (!file.exists()) {
            throw new FileNotFoundException("File not found " + file);
        }
        mConfiguration = new XMLConfiguration(file);
        // we could also use the XPath engine
        // for example for tables/table[@name='users']/fields/name
        //            mConfiguration.setExpressionEngine(new XPathExpressionEngine());
        mFile = file;
    } catch (ConfigurationException e) {
        throw new BadConfigException(e.getMessage());
    }
}

From source file:com.ah.be.admin.restoredb.AhRestoreDBImpl.java

private static VHMCustomerInfo getVhmInfos(String vhmId) {

    String username = "hmol@portal";
    String password = "";
    try {//from   w  w w .j  a va2s .c om
        PropertiesConfiguration config = new PropertiesConfiguration("/etc/secretkey");
        password = config.getString("portal.rest.key.hmol@portal");
    } catch (ConfigurationException e1) {
        AhRestoreDBTools.logRestoreErrorMsg("Retrieve VHM (" + vhmId
                + ") info from Portal, get REST API cretential failed." + e1.getMessage());
        password = "aerohive";
    }
    PortalResUtils portalResUtils = PortalResUtils.getInstance(username,
            password.getBytes(BasicAuthFilter.CHARACTER_SET));
    VHMCustomerInfo vhminfo = null;
    try {
        vhminfo = portalResUtils.getVHMCustomerInfo(vhmId);
    } catch (Exception e) {
        AhRestoreDBTools.logRestoreErrorMsg("Retrieve VHM (" + vhmId + ") info from Portal (call API "
                + PathConstant.POR_VHM_CUSTOMERINFORMATION_PATH + ") error." + e.getMessage());
    }
    return vhminfo;
}

From source file:com.processpuzzle.application.configuration.domain.PropertyContext.java

@Override
protected void setUpTransientComponents() {
    File resourceFile = null;/*from   ww w  .ja  va2s.c om*/
    try {
        log.debug("Trying to load resource: " + configurationDescriptorUrl);
        Resource resource = loader.getResource(configurationDescriptorUrl);
        if (resource != null)
            resourceFile = resource.getFile();
        else
            throw new IOException(
                    "Configuration descriptor: " + configurationDescriptorUrl + " can't be load.");

        DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder(resourceFile);
        configuration = configurationBuilder.getConfiguration(true);
        configuration.setExpressionEngine(new DefaultExpressionEngine());
    } catch (ConfigurationException e) {
        log.debug(e.getMessage());
        throw new ConfigurationSetUpException(configurationDescriptorUrl, e);
    } catch (IOException e) {
        throw new UndefinedPropertyDescriptorException(configurationDescriptorUrl, e);
    }
}

From source file:com.vangent.hieos.hl7v2util.acceptor.config.AcceptorConfig.java

/**
 * //from  w  w w . j a va  2  s. co m
 * @param configLocation
 * @throws HL7v2UtilException
 */
private void loadConfiguration(String configLocation) throws HL7v2UtilException {
    try {
        logger.info("Loading HL7v2Acceptor configuration from " + configLocation);
        XMLConfiguration xmlConfig = new XMLConfiguration(configLocation);

        this.loadMessageHandlerConfigs(xmlConfig);
        this.loadListenerConfigs(xmlConfig);
    } catch (ConfigurationException ex) {
        throw new HL7v2UtilException("HL7v2AcceptorConfig: Could not load configuration from " + configLocation
                + " " + ex.getMessage());
    }
}

From source file:dk.dma.ais.abnormal.stat.AbnormalStatBuilderAppModule.java

@Provides
@Singleton// w  w  w .  j a v a 2  s.  co  m
Configuration provideConfiguration() {
    Configuration configuration = null;
    try {
        PropertiesConfiguration configFile = new PropertiesConfiguration("stat-builder.properties");
        configuration = configFile;
        LOG.info("Loaded configuration file " + configFile.getFile().toString() + ".");
    } catch (ConfigurationException e) {
        configuration = new BaseConfiguration();
        LOG.warn(e.getMessage() + ". Using blank configuration.");
    }
    return configuration;
}

From source file:com.bacic5i5j.framework.Gemini.java

/**
 * ?Gemini?/*from   w w w. j a  va  2  s .  c  o  m*/
 */
public void init() {
    //
    try {
        config = new PropertiesConfiguration("global.properties");
    } catch (ConfigurationException e) {
        System.err.println(
                "??classglobal.properties: "
                        + e.getMessage());
    }

    modules.add(new GeminiModule(this));
    this.injector = Guice.createInjector(modules);

    this.loggerFactory = this.injector.getInstance(LoggerFactory.class);
    this.logger = loggerFactory.getLogger(Gemini.class);

    this.logger.info("???");

    if (config != null) {
        logger.info(": " + config.getString("webapp.dir"));
    }
}