mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 09:09:31 +01:00
Slight simplification to standard getInt and getLong.
This commit is contained in:
@@ -659,13 +659,11 @@ public final class Settings {
|
|||||||
* @throws InvalidSettingException is thrown if there is an error retrieving the setting
|
* @throws InvalidSettingException is thrown if there is an error retrieving the setting
|
||||||
*/
|
*/
|
||||||
public static int getInt(String key) throws InvalidSettingException {
|
public static int getInt(String key) throws InvalidSettingException {
|
||||||
int value;
|
|
||||||
try {
|
try {
|
||||||
value = Integer.parseInt(Settings.getString(key));
|
return Integer.parseInt(Settings.getString(key));
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", 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
|
* @throws InvalidSettingException is thrown if there is an error retrieving the setting
|
||||||
*/
|
*/
|
||||||
public static long getLong(String key) throws InvalidSettingException {
|
public static long getLong(String key) throws InvalidSettingException {
|
||||||
long value;
|
|
||||||
try {
|
try {
|
||||||
value = Long.parseLong(Settings.getString(key));
|
return Long.parseLong(Settings.getString(key));
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
|
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
|
||||||
}
|
}
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user