Archived
0

Core:fix: преобразование типов в ConfigImpl

This commit is contained in:
2017-04-29 15:06:44 +03:00
parent d021c38e89
commit c9af162ff5
2 changed files with 11 additions and 3 deletions

View File

@@ -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;
}
}