/** * Get the setting for the given key. * * @param key the key * @param defaultValue the default value * @return the setting */ private int get(String key, int defaultValue) { String s = get(key, Integer.toString(defaultValue)); try { return Integer.decode(s); } catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); } }
/** * Get the setting for the given key. * * @param key the key * @param defaultValue the default value * @return the setting */ private boolean get(String key, boolean defaultValue) { String s = get(key, defaultValue ? "true" : "false"); try { return Boolean.parseBoolean(s); } catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); } }