Slight simplification to standard getInt and getLong.

This commit is contained in:
Anthony Whitford
2015-10-08 00:56:38 -07:00
parent 274ac339ad
commit f2a2a91682

View File

@@ -659,13 +659,11 @@ public final class Settings {
* @throws InvalidSettingException is thrown if there is an error retrieving the setting
*/
public static int getInt(String key) throws InvalidSettingException {
int value;
try {
value = Integer.parseInt(Settings.getString(key));
return Integer.parseInt(Settings.getString(key));
} catch (NumberFormatException ex) {
throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex);
}
return value;
}
/**
@@ -699,13 +697,11 @@ public final class Settings {
* @throws InvalidSettingException is thrown if there is an error retrieving the setting
*/
public static long getLong(String key) throws InvalidSettingException {
long value;
try {
value = Long.parseLong(Settings.getString(key));
return Long.parseLong(Settings.getString(key));
} catch (NumberFormatException ex) {
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
}
return value;
}
/**