diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2008-12-13 11:32:24 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2008-12-13 11:32:24 +0000 |
commit | 89f728384cd9941fbc045e01b5f4cb2758cc1aea (patch) | |
tree | 07345d19a188c1564af7680eb7486e44c8d156e6 /src/net/java/sip/communicator/impl/configuration | |
parent | 974151c18cf4c49b6b074fce749bd1c06b31aa39 (diff) | |
download | jitsi-89f728384cd9941fbc045e01b5f4cb2758cc1aea.zip jitsi-89f728384cd9941fbc045e01b5f4cb2758cc1aea.tar.gz jitsi-89f728384cd9941fbc045e01b5f4cb2758cc1aea.tar.bz2 |
Minor elimination of code duplication.
Diffstat (limited to 'src/net/java/sip/communicator/impl/configuration')
-rw-r--r-- | src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java index 07f31c4..ee46df1 100644 --- a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java @@ -1071,6 +1071,27 @@ public class ConfigurationServiceImpl .parseBoolean(stringValue); } + public int getInt(String propertyName, int defaultValue) + { + String stringValue = getString(propertyName); + int intValue = defaultValue; + + if (stringValue != null) + { + try + { + intValue = Integer.parseInt(stringValue); + } + catch (NumberFormatException ex) + { + logger.error(propertyName + + " does not appear to be an integer. " + "Defaulting to " + + defaultValue + ".", ex); + } + } + return intValue; + } + /** * We use property references when we'd like to store system properties. * Simply storing System properties in our properties Map would not be |