From a75a1819f4c7fa5080ddb47545fe9012a842e5b3 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Wed, 20 Jul 2011 21:08:57 -0400 Subject: [PATCH] Misc fixes. --- src/com/gitblit/IStoredSettings.java | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/src/com/gitblit/IStoredSettings.java b/src/com/gitblit/IStoredSettings.java index b380c63..0cc4bb4 100644 --- a/src/com/gitblit/IStoredSettings.java +++ b/src/com/gitblit/IStoredSettings.java @@ -116,6 +116,26 @@ } return defaultValue; } + + /** + * Returns the char value for the specified key. If the key does not exist + * or the value for the key can not be interpreted as a char, the + * defaultValue is returned. + * + * @param key + * @param defaultValue + * @return key value or defaultValue + */ + public char getChar(String name, char defaultValue) { + Properties props = getSettings(); + if (props.containsKey(name)) { + String value = props.getProperty(name); + if (!StringUtils.isEmpty(value)) { + return value.charAt(0); + } + } + return defaultValue; + } /** * Returns the string value for the specified key. If the key does not exist -- Gitblit v1.9.1