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

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

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.zaproxy.zap.spider.SpiderParam.java

@Override
protected void parse() {
    updateOptions();//from ww w  .  j  av  a 2 s  . c  o  m

    // Use try/catch for every parameter so if the parsing of one fails, it's continued for the
    // others.
    try {
        this.threadCount = getConfig().getInt(SPIDER_THREAD, 2);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.maxDepth = getConfig().getInt(SPIDER_MAX_DEPTH, 5);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.maxScansInUI = getConfig().getInt(MAX_SCANS_IN_UI, 5);
    } catch (Exception e) {
    }

    try {
        this.showAdvancedDialog = getConfig().getBoolean(SHOW_ADV_DIALOG, false);
    } catch (Exception e) {
    }

    try {
        this.processForm = getConfig().getBoolean(SPIDER_PROCESS_FORM, false);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.postForm = getConfig().getBoolean(SPIDER_POST_FORM, false);
    } catch (ConversionException e) {
        // conversion issue from 1.4.1: convert the field from int to boolean
        log.info("Warning while parsing config file: " + SPIDER_POST_FORM
                + " was not in the expected format due to an upgrade. Converting  it!");
        if (!getConfig().getProperty(SPIDER_POST_FORM).toString().equals("0")) {
            getConfig().setProperty(SPIDER_POST_FORM, "true");
            this.postForm = true;
        } else {
            getConfig().setProperty(SPIDER_POST_FORM, "false");
            this.postForm = false;
        }
    }

    try {
        this.requestWait = getConfig().getInt(SPIDER_REQUEST_WAIT, 200);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.parseComments = getConfig().getBoolean(SPIDER_PARSE_COMMENTS, true);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.parseRobotsTxt = getConfig().getBoolean(SPIDER_PARSE_ROBOTS_TXT, true);
    } catch (Exception e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.parseSitemapXml = getConfig().getBoolean(SPIDER_PARSE_SITEMAP_XML, true);
    } catch (Exception e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.parseSVNentries = getConfig().getBoolean(SPIDER_PARSE_SVN_ENTRIES, false);
    } catch (Exception e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.parseGit = getConfig().getBoolean(SPIDER_PARSE_GIT, false);
    } catch (Exception e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        setSkipURLString(getConfig().getString(SPIDER_SKIP_URL, ""));
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        setHandleParameters(HandleParametersOption.valueOf(
                getConfig().getString(SPIDER_HANDLE_PARAMETERS, HandleParametersOption.USE_ALL.toString())));
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    try {
        this.handleODataParametersVisited = getConfig().getBoolean(SPIDER_HANDLE_ODATA_PARAMETERS, false);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
    }

    loadDomainsAlwaysInScope();
    try {
        this.confirmRemoveDomainAlwaysInScope = getConfig().getBoolean(CONFIRM_REMOVE_DOMAIN_ALWAYS_IN_SCOPE,
                true);
    } catch (ConversionException e) {
        log.error("Error while loading the confirm \"domain always in scope\" remove option: " + e.getMessage(),
                e);
    }

    try {
        this.sendRefererHeader = getConfig().getBoolean(SPIDER_SENDER_REFERER_HEADER, true);
    } catch (ConversionException e) {
        log.error("Error while parsing config file: " + e.getMessage(), e);
        sendRefererHeader = true;
    }
}

From source file:uk.ac.ebi.arrayexpress.app.ApplicationPreferences.java

public Integer getInteger(String key) {
    Integer value = null;/*w  w  w . j a va2 s.c  om*/
    try {
        value = prefs.getInt(key);
    } catch (ConversionException x) {
        logger.error(x.getMessage());
    } catch (NoSuchElementException x) {
        logger.error(x.getMessage());
    } catch (Exception x) {
        logger.error("Caught an exception:", x);
    }
    return value;
}

From source file:uk.ac.ebi.arrayexpress.app.ApplicationPreferences.java

public Long getLong(String key) {
    Long value = null;// w  w w .  j  a  va  2s. c  om
    try {
        value = prefs.getLong(key);
    } catch (ConversionException x) {
        logger.error(x.getMessage());
    } catch (NoSuchElementException x) {
        logger.error(x.getMessage());
    } catch (Exception x) {
        logger.error("Caught an exception:", x);
    }
    return value;
}