List of usage examples for org.apache.commons.configuration ConversionException getMessage
public String getMessage()
From source file:org.parosproxy.paros.extension.option.OptionsParamCertificate.java
@Override protected void parse() { // always turn off client cert setUseClientCert(false);//from w w w. j a v a 2 s. c o m setClientCertLocation(""); try { allowUnsafeSslRenegotiation = getConfig().getBoolean(ALLOW_UNSAFE_SSL_RENEGOTIATION, false); setAllowUnsafeSslRenegotiationSystemProperty(allowUnsafeSslRenegotiation); } catch (ConversionException e) { logger.error("Error while loading the option Allow Unsafe SSL Renegotiation: " + e.getMessage(), e); } }
From source file:org.parosproxy.paros.extension.option.OptionsParamView.java
@Override protected void parse() { // use temp variable to check. Exception will be flagged if any error. showTabNames = getConfig().getBoolean(SHOW_TEXT_ICONS, true); processImages = getConfig().getInt(PROCESS_IMAGES, 0); configLocale = getConfig().getString(LOCALE, null); // No default locale = getConfig().getString(LOCALE, DEFAULT_LOCALE); displayOption = getConfig().getInt(DISPLAY_OPTION, 0); responsePanelPosition = getConfig().getString(RESPONSE_PANEL_POS_KEY, WorkbenchPanel.ResponsePanelPosition.TABS_SIDE_BY_SIDE.name()); brkPanelViewOption = getConfig().getInt(BRK_PANEL_VIEW_OPTION, 0); showMainToolbar = getConfig().getInt(SHOW_MAIN_TOOLBAR_OPTION, 1); advancedViewEnabled = getConfig().getInt(ADVANCEDUI_OPTION, 0); wmUiHandlingEnabled = getConfig().getInt(WMUIHANDLING_OPTION, 0); askOnExitEnabled = getConfig().getInt(ASKONEXIT_OPTION, 1); warnOnTabDoubleClick = getConfig().getBoolean(WARN_ON_TAB_DOUBLE_CLICK_OPTION, true); mode = getConfig().getString(MODE_OPTION, Mode.standard.name()); outputTabTimeStampingEnabled = getConfig().getBoolean(OUTPUT_TAB_TIMESTAMPING_OPTION, false); outputTabTimeStampFormat = getConfig().getString(OUTPUT_TAB_TIMESTAMP_FORMAT, DEFAULT_TIME_STAMP_FORMAT); try {//from w w w. j av a2 s . com showLocalConnectRequests = getConfig().getBoolean(SHOW_LOCAL_CONNECT_REQUESTS, false); } catch (ConversionException e) { LOGGER.error("Error while parsing config file: " + e.getMessage(), e); } showSplashScreen = getConfig().getBoolean(SPLASHSCREEN_OPTION, true); largeRequestSize = getConfig().getInteger(LARGE_REQUEST_SIZE, LargeRequestUtil.DEFAULT_MIN_CONTENT_LENGTH); largeResponseSize = getConfig().getInteger(LARGE_RESPONSE_SIZE, LargeResponseUtil.DEFAULT_MIN_CONTENT_LENGTH); fontSize = getConfig().getInteger(FONT_SIZE, -1); fontName = getConfig().getString(FONT_NAME, ""); scaleImages = getConfig().getBoolean(SCALE_IMAGES, true); showDevWarning = getConfig().getBoolean(SHOW_DEV_WARNING, true); // Special cases - set via static methods LargeRequestUtil.setMinContentLength(largeRequestSize); LargeResponseUtil.setMinContentLength(largeResponseSize); try { this.confirmRemoveProxyExcludeRegex = getConfig().getBoolean(CONFIRM_REMOVE_PROXY_EXCLUDE_REGEX_KEY, false); } catch (ConversionException e) { LOGGER.error("Error while parsing config file: " + e.getMessage(), e); } try { this.confirmRemoveScannerExcludeRegex = getConfig().getBoolean(CONFIRM_REMOVE_SCANNER_EXCLUDE_REGEX_KEY, false); } catch (ConversionException e) { LOGGER.error("Error while parsing config file: " + e.getMessage(), e); } try { this.confirmRemoveSpiderExcludeRegex = getConfig().getBoolean(CONFIRM_REMOVE_SPIDER_EXCLUDE_REGEX_KEY, false); } catch (ConversionException e) { LOGGER.error("Error while parsing config file: " + e.getMessage(), e); } }
From source file:org.zaproxy.zap.common.VersionedAbstractParam.java
/** * Reads the version number from the configuration file, using the key returned by {@code getConfigVersionKey()}. * <p>// w w w . j av a 2s . c o m * <strong>Note:</strong> It shouldn't be overridden in normal conditions. * * @return the version number read, or {@code NO_CONFIG_VERSION} if no version was found or * {@code ERROR_READING_CONFIG_VERSION} if an error occurred while reading the version * @see #NO_CONFIG_VERSION * @see #ERROR_READING_CONFIG_VERSION * @see #getConfigVersionKey() */ protected int readConfigFileVersion() { try { return getConfig().getInt(getConfigVersionKey(), NO_CONFIG_VERSION); } catch (ConversionException e) { logger.error("Error while getting the version of the configurations: " + e.getMessage(), e); return ERROR_READING_CONFIG_VERSION; } }
From source file:org.zaproxy.zap.extension.alert.AlertParam.java
/** * Parses the alert options.//from ww w . j a va2s . c om * * @see #getMaximumInstances() */ @Override protected void parse() { try { maximumInstances = getConfig().getInt(PARAM_MAXIMUM_INSTANCES, DEFAULT_MAXIMUM_INSTANCES); } catch (ConversionException e) { LOGGER.error("Failed to load the \"Maximum instances\" configuration: " + e.getMessage(), e); } try { mergeRelatedIssues = getConfig().getBoolean(PARAM_MERGE_RELATED_ISSUES, true); } catch (ConversionException e) { LOGGER.error("Failed to load the \"old format\" configuration: " + e.getMessage(), e); } }
From source file:org.zaproxy.zap.extension.anticsrf.AntiCsrfParam.java
@Override protected void parse() { try {/*w w w. ja v a2s. c om*/ List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()) .configurationsAt(ALL_TOKENS_KEY); this.tokens = new ArrayList<>(fields.size()); enabledTokensNames = new ArrayList<>(fields.size()); List<String> tempTokensNames = new ArrayList<>(fields.size()); for (HierarchicalConfiguration sub : fields) { String name = sub.getString(TOKEN_NAME_KEY, ""); if (!"".equals(name) && !tempTokensNames.contains(name)) { boolean enabled = sub.getBoolean(TOKEN_ENABLED_KEY, true); this.tokens.add(new AntiCsrfParamToken(name, enabled)); tempTokensNames.add(name); if (enabled) { enabledTokensNames.add(name); } } } } catch (ConversionException e) { logger.error("Error while loading anti CSRF tokens: " + e.getMessage(), e); this.tokens = new ArrayList<>(DEFAULT_TOKENS_NAMES.length); this.enabledTokensNames = new ArrayList<>(DEFAULT_TOKENS_NAMES.length); } if (this.tokens.size() == 0) { for (String tokenName : DEFAULT_TOKENS_NAMES) { this.tokens.add(new AntiCsrfParamToken(tokenName)); this.enabledTokensNames.add(tokenName); } } try { this.confirmRemoveToken = getConfig().getBoolean(CONFIRM_REMOVE_TOKEN_KEY, true); } catch (ConversionException e) { logger.error("Error while loading the confirm remove token option: " + e.getMessage(), e); } }
From source file:org.zaproxy.zap.extension.browserView.BrowserViewParam.java
/** * Updates the configurations in the file, if needed. * * <p>The following steps are made: * * <ol>//ww w.jav a 2 s . co m * <li>Read the version of the configurations that are in the file; * <li>Check if the version read is the latest version; * <li>If it's not at the latest version, update the configurations. * </ol> * * @see #CURRENT_CONFIG_VERSION * @see #isLatestConfigVersion(int) * @see #updateConfigsFromVersion(int) */ private void updateConfigFile() { int configVersion; try { configVersion = getConfig().getInt(CONFIG_VERSION_KEY, NO_CONFIG_VERSION); } catch (ConversionException e) { LOGGER.error("Error while getting the version of the configurations: " + e.getMessage(), e); configVersion = ERROR_READING_CONFIG_VERSION; } if (!isLatestConfigVersion(configVersion)) { updateConfigsFromVersion(configVersion); } }
From source file:org.zaproxy.zap.extension.bugtracker.BugTrackerBugzillaParam.java
@Override protected void parse() { try {/*from www . j a va 2s.c o m*/ List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()) .configurationsAt(ALL_CONFIGS_KEY); this.configs = new ArrayList<>(fields.size()); // enabledConfigsNames = new ArrayList<>(fields.size()); List<String> tempConfigsNames = new ArrayList<>(fields.size()); for (HierarchicalConfiguration sub : fields) { String name = sub.getString(CONFIG_NAME_KEY, ""); String password = sub.getString(CONFIG_PASSWORD_KEY, ""); String bugzillaUrl = sub.getString(CONFIG_BUGZILLA_URL_KEY, ""); if (!"".equals(name) && !tempConfigsNames.contains(name)) { this.configs.add(new BugTrackerBugzillaConfigParams(name, password, bugzillaUrl)); tempConfigsNames.add(name); // if (enabled) { // enabledConfigsNames.add(name); // } } } } catch (ConversionException e) { logger.error("Error while loading bugzilla configs: " + e.getMessage(), e); // this.configs = new ArrayList<>(DEFAULT_CONFIGS_NAMES.length); // this.enabledConfigsNames = new ArrayList<>(DEFAULT_CONFIGS_NAMES.length); } // if (this.configs.size() == 0) { // for (String configName : DEFAULT_CONFIGS_NAMES) { // this.configs.add(new BugTrackerBugzillaConfigParams(configName)); // this.enabledConfigsNames.add(configName); // } // } try { this.confirmRemoveConfig = getConfig().getBoolean(CONFIRM_REMOVE_CONFIG_KEY, true); } catch (ConversionException e) { logger.error("Error while loading the confirm remove config option: " + e.getMessage(), e); } }
From source file:org.zaproxy.zap.extension.bugtracker.BugTrackerGithubParam.java
@Override protected void parse() { try {/*from w ww . j a va 2s . com*/ List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()) .configurationsAt(ALL_CONFIGS_KEY); this.configs = new ArrayList<>(fields.size()); List<String> tempConfigsNames = new ArrayList<>(fields.size()); for (HierarchicalConfiguration sub : fields) { String name = sub.getString(CONFIG_NAME_KEY, ""); String password = sub.getString(CONFIG_PASSWORD_KEY, ""); String repoUrl = sub.getString(CONFIG_REPO_URL_KEY, ""); if (!"".equals(name) && !tempConfigsNames.contains(name)) { this.configs.add(new BugTrackerGithubConfigParams(name, password, repoUrl)); tempConfigsNames.add(name); } } } catch (ConversionException e) { logger.error("Error while loading github configs: " + e.getMessage(), e); } try { this.confirmRemoveConfig = getConfig().getBoolean(CONFIRM_REMOVE_CONFIG_KEY, true); } catch (ConversionException e) { logger.error("Error while loading the confirm remove config option: " + e.getMessage(), e); } }
From source file:org.zaproxy.zap.extension.ext.ExtensionParam.java
@Override protected void parse() { try {//from ww w. jav a 2 s . co m List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()) .configurationsAt(ALL_EXTENSIONS_KEY); Map<String, Boolean> extensions = new HashMap<>(); for (HierarchicalConfiguration sub : fields) { if (!sub.getBoolean(EXTENSION_ENABLED_KEY, true)) { extensions.put(sub.getString(EXTENSION_NAME_KEY, ""), Boolean.FALSE); } } extensionsState = Collections.unmodifiableMap(extensions); } catch (ConversionException e) { LOGGER.error("Error while loading extensions' state: " + e.getMessage(), e); extensionsState = Collections.emptyMap(); } }
From source file:org.zaproxy.zap.extension.formhandler.FormHandlerParam.java
@Override protected void parse() { try {/* www . j ava 2s .c om*/ List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()) .configurationsAt(ALL_TOKENS_KEY); this.fields = new ArrayList<>(fields.size()); enabledFieldsNames = new ArrayList<>(fields.size()); List<String> tempFieldsNames = new ArrayList<>(fields.size()); for (HierarchicalConfiguration sub : fields) { String value = sub.getString(TOKEN_VALUE_KEY, ""); String name = sub.getString(TOKEN_NAME_KEY, ""); if (!"".equals(name) && !tempFieldsNames.contains(name)) { boolean enabled = sub.getBoolean(TOKEN_ENABLED_KEY, true); this.fields.add(new FormHandlerParamField(name, value, enabled)); tempFieldsNames.add(name); if (enabled) { enabledFieldsNames.add(name); } } } } catch (ConversionException e) { logger.error("Error while loading key-value pair fields: " + e.getMessage(), e); this.fields = new ArrayList<>(DEFAULT_KEY_VALUE_PAIRS.size()); this.enabledFieldsNames = new ArrayList<>(DEFAULT_KEY_VALUE_PAIRS.size()); } if (this.fields.size() == 0) { // Grab the entry for every set in the map for (Map.Entry<String, String> entry : DEFAULT_KEY_VALUE_PAIRS.entrySet()) { // Store the key and value of that entry in variables String name = entry.getKey(); String value = entry.getValue(); this.fields.add(new FormHandlerParamField(name, value)); this.enabledFieldsNames.add(name); } } try { this.confirmRemoveField = getConfig().getBoolean(CONFIRM_REMOVE_TOKEN_KEY, true); } catch (ConversionException e) { logger.error("Error while loading the confirm remove field option: " + e.getMessage(), e); } }