Core:fix: преобразование типов в ConfigImpl
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
group = 'asys'
|
||||
version = '0.3-SNAPSHOT'
|
||||
version = '0.3.1-SNAPSHOT'
|
||||
|
||||
apply plugin: 'application'
|
||||
|
||||
|
||||
@@ -32,7 +32,11 @@ public class ConfigImpl implements Config {
|
||||
|
||||
@Override
|
||||
public int getInt(String key, int defaultValue) {
|
||||
return (int) properties.getOrDefault(key, defaultValue);
|
||||
int result = defaultValue;
|
||||
try {
|
||||
result = Integer.parseInt(properties.getProperty(key));
|
||||
} catch (NumberFormatException ignore) {}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,6 +46,10 @@ public class ConfigImpl implements Config {
|
||||
|
||||
@Override
|
||||
public long getLong(String key, long defaultValue) {
|
||||
return (long) properties.getOrDefault(key, defaultValue);
|
||||
long result = defaultValue;
|
||||
try {
|
||||
result = Long.parseLong(properties.getProperty(key));
|
||||
} catch (NumberFormatException ignore) {}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user