From 7e5ee5a454ec396b5dc2f00e89adeca84d6ef683 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Mon, 18 Jul 2011 18:10:34 -0400 Subject: [PATCH] Allow specification of forward-slash character in urls (issue 11) --- 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