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

@@ -1,5 +1,5 @@
group = 'asys' group = 'asys'
version = '0.3-SNAPSHOT' version = '0.3.1-SNAPSHOT'
apply plugin: 'application' apply plugin: 'application'

View File

@@ -32,7 +32,11 @@ public class ConfigImpl implements Config {
@Override @Override
public int getInt(String key, int defaultValue) { 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 @Override
@@ -42,6 +46,10 @@ public class ConfigImpl implements Config {
@Override @Override
public long getLong(String key, long defaultValue) { 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;
} }
} }