Example usage for org.apache.commons.configuration ConversionException ConversionException

List of usage examples for org.apache.commons.configuration ConversionException ConversionException

Introduction

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

Prototype

public ConversionException(String message, Throwable cause) 

Source Link

Document

Constructs a new ConversionException with specified detail message and nested Throwable.

Usage

From source file:fr.dudie.acrachilisync.utils.ConfigurationManager.java

/**
 * Converts a String representing an URL to an {@link URL} or throw a
 * {@link org.apache.commons.configuration.ConversionException}.
 * //from w w  w .jav a 2 s .  co  m
 * @param pUrl
 *            a URL as a string
 * @return an URL object
 */
public URL getURL(final String pUrl) {

    try {
        return new URL(pUrl);
    } catch (final MalformedURLException e) {
        throw new ConversionException("Cannot parse URL from string " + pUrl, e);
    }
}

From source file:cz.cas.lib.proarc.common.imports.ImportProfile.java

private ScalingMethod getJavaScaling(String key) {
    String val = config.getString(key);
    if (val == null || val.isEmpty()) {
        return ScalingMethod.BICUBIC_STEPPED;
    }//  w  ww. j  a  va  2 s.c o m
    try {
        ScalingMethod hint = ScalingMethod.valueOf(val);
        return hint;
    } catch (Exception e) {
        throw new ConversionException(key, e);
    }
}

From source file:ee.ria.xroad.signer.tokenmanager.module.ModuleConf.java

private static Boolean getBoolean(SubnodeConfiguration section, String key, Boolean defaultValue) {
    try {//from  w w  w  .  j  a  va2s .c  o  m
        return section.getBoolean(key, defaultValue);
    } catch (ConversionException e) {
        throw new ConversionException(String.format("Invalid value of '%s' for module (%s), skipping...", key,
                section.getSubnodeKey()), e);
    }
}

From source file:ee.ria.xroad.signer.tokenmanager.module.ModuleConf.java

private static String[] getStringArray(SubnodeConfiguration section, String key) {
    try {/*from w w  w  .j  a  v  a2  s. c  om*/
        return section.getStringArray(key);
    } catch (ConversionException e) {
        throw new ConversionException(String.format("Invalid value of '%s' for module (%s), skipping...", key,
                section.getSubnodeKey()), e);
    }
}