diff options
author | Anton Tananaev <atananaev@lyft.com> | 2020-12-28 17:02:23 -0800 |
---|---|---|
committer | Anton Tananaev <atananaev@lyft.com> | 2020-12-28 17:02:23 -0800 |
commit | 51704590a835057bf4850a5eaf8c5037d20f648a (patch) | |
tree | c38acebce6cfec36ead21918d6272a99452b9ac5 /src/main/java/org/traccar/config/Config.java | |
parent | 551298664bbac541450d83a021a2f8d77e65b216 (diff) | |
download | trackermap-server-51704590a835057bf4850a5eaf8c5037d20f648a.tar.gz trackermap-server-51704590a835057bf4850a5eaf8c5037d20f648a.tar.bz2 trackermap-server-51704590a835057bf4850a5eaf8c5037d20f648a.zip |
Migrate long config keys
Diffstat (limited to 'src/main/java/org/traccar/config/Config.java')
-rw-r--r-- | src/main/java/org/traccar/config/Config.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/config/Config.java b/src/main/java/org/traccar/config/Config.java index 6cc21cbeb..713f5c607 100644 --- a/src/main/java/org/traccar/config/Config.java +++ b/src/main/java/org/traccar/config/Config.java @@ -117,17 +117,17 @@ public class Config { } public long getLong(ConfigKey<Long> key) { - return getLong(key.getKey()); - } - - @Deprecated - public long getLong(String key) { - return getLong(key, 0); - } - - @Deprecated - public long getLong(String key, long defaultValue) { - return hasKey(key) ? Long.parseLong(getString(key)) : defaultValue; + String value = getString(key.getKey()); + if (value != null) { + return Long.parseLong(value); + } else { + Long defaultValue = key.getDefaultValue(); + if (defaultValue != null) { + return defaultValue; + } else { + return 0; + } + } } public double getDouble(ConfigKey<Double> key) { |