/** {@inheritDoc} */ @Override public boolean getBoolean(Config config, String section, String subsection, String name, boolean defaultValue) { String n = config.getRawString(section, subsection, name); if (n == null) { return defaultValue; } if (Config.MAGIC_EMPTY_VALUE == n) { return true; } try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidBooleanValue, section, name, n)); } }
private AtomicFileCreation getAtomicFileCreationSupportOption( FileBasedConfig config) { try { config.load(); String value = config.getString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_SUPPORTSATOMICFILECREATION); if (value == null) { return AtomicFileCreation.UNDEFINED; } return StringUtils.toBoolean(value) ? AtomicFileCreation.SUPPORTED : AtomicFileCreation.NOT_SUPPORTED; } catch (IOException | ConfigInvalidException e) { return AtomicFileCreation.SUPPORTED; } }
return StringUtils.toBoolean(n) ? trueState : falseState; } catch (IllegalArgumentException err) {
private static boolean getBoolean(FilterConfig cfg, String param) throws ServletException { String n = cfg.getInitParameter(param); if (n == null) return false; try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new ServletException(MessageFormat.format(HttpServerText.get().invalidBoolean, param, n)); } }
private static boolean getBoolean(FilterConfig cfg, String param) throws ServletException { String n = cfg.getInitParameter(param); if (n == null) return false; try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new ServletException(MessageFormat.format(HttpServerText.get().invalidBoolean, param, n)); } }
/** {@inheritDoc} */ @Override public boolean getBoolean(Config config, String section, String subsection, String name, boolean defaultValue) { String n = config.getRawString(section, subsection, name); if (n == null) { return defaultValue; } if (Config.MAGIC_EMPTY_VALUE == n) { return true; } try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidBooleanValue, section, name, n)); } }
private AtomicFileCreation getAtomicFileCreationSupportOption( FileBasedConfig config) { try { config.load(); String value = config.getString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_SUPPORTSATOMICFILECREATION); if (value == null) { return AtomicFileCreation.UNDEFINED; } return StringUtils.toBoolean(value) ? AtomicFileCreation.SUPPORTED : AtomicFileCreation.NOT_SUPPORTED; } catch (IOException | ConfigInvalidException e) { return AtomicFileCreation.SUPPORTED; } }
/** * Get a boolean value from the git config * * @param section * section the key is grouped within. * @param subsection * subsection name, such a remote or branch name. * @param name * name of the key to get. * @param defaultValue * default value to return if no value was present. * @return true if any value or defaultValue is true, false for missing or * explicit false */ public boolean getBoolean(final String section, String subsection, final String name, final boolean defaultValue) { String n = getRawString(section, subsection, name); if (n == null) return defaultValue; if (MAGIC_EMPTY_VALUE == n) return true; try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidBooleanValue , section, name, n)); } }
return StringUtils.toBoolean(n) ? trueState : falseState; } catch (IllegalArgumentException err) {
return StringUtils.toBoolean(n) ? trueState : falseState; } catch (IllegalArgumentException err) {