aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-10-17 21:08:38 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-10-17 21:08:38 +0000
commit7277bf34b9abb4a5b2fa4f4984d2bc02952b432d (patch)
tree63688aafcc8c535b6b1e1d6ad9d27be62d3ac4da /src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
parent0f148ad9c13d7e197d7ed14c8024a919fa289473 (diff)
downloadjitsi-7277bf34b9abb4a5b2fa4f4984d2bc02952b432d.zip
jitsi-7277bf34b9abb4a5b2fa4f4984d2bc02952b432d.tar.gz
jitsi-7277bf34b9abb4a5b2fa4f4984d2bc02952b432d.tar.bz2
Prevents NumberFormatException in the cases in which it is clear that it will be thrown and caught for the sake of performance.
Diffstat (limited to 'src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java')
-rw-r--r--src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
index 2643a3b..f47374b 100644
--- a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
@@ -1051,15 +1051,33 @@ public class ConfigurationServiceImpl
.parseBoolean(stringValue);
}
- /*
- * Implements ConfigurationService#getInt(String, int).
+ /**
+ * Gets the value of a specific property as a signed decimal integer. If the
+ * specified property name is associated with a value in this
+ * <tt>ConfigurationService</tt>, the string representation of the value is
+ * parsed into a signed decimal integer according to the rules of
+ * {@link Integer#parseInt(String)} . If parsing the value as a signed
+ * decimal integer fails or there is no value associated with the specified
+ * property name, <tt>defaultValue</tt> is returned.
+ *
+ * @param propertyName the name of the property to get the value of as a
+ * signed decimal integer
+ * @param defaultValue the value to be returned if parsing the value of the
+ * specified property name as a signed decimal integer fails or there is no
+ * value associated with the specified property name in this
+ * <tt>ConfigurationService</tt>
+ * @return the value of the property with the specified name in this
+ * <tt>ConfigurationService</tt> as a signed decimal integer;
+ * <tt>defaultValue</tt> if parsing the value of the specified property name
+ * fails or no value is associated in this <tt>ConfigurationService</tt>
+ * with the specified property name
*/
public int getInt(String propertyName, int defaultValue)
{
String stringValue = getString(propertyName);
int intValue = defaultValue;
- if (stringValue != null)
+ if ((stringValue != null) && (stringValue.length() > 0))
{
try
{