diff options
author | Anton Tananaev <anton@traccar.org> | 2024-05-04 19:35:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-05-04 19:35:52 -0700 |
commit | c2993f0451749f3b127aa64892eb3db60360a4b6 (patch) | |
tree | 8941c924381aa7a3b31b4384667bbcff09369946 | |
parent | 93828126208b569b360fedecb1e87b4ed809b298 (diff) | |
download | trackermap-server-c2993f0451749f3b127aa64892eb3db60360a4b6.tar.gz trackermap-server-c2993f0451749f3b127aa64892eb3db60360a4b6.tar.bz2 trackermap-server-c2993f0451749f3b127aa64892eb3db60360a4b6.zip |
Support true as boolean default
-rw-r--r-- | src/main/java/org/traccar/config/Config.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/config/Config.java b/src/main/java/org/traccar/config/Config.java index 409a3f16a..2d76a5c70 100644 --- a/src/main/java/org/traccar/config/Config.java +++ b/src/main/java/org/traccar/config/Config.java @@ -92,7 +92,13 @@ public class Config { } public boolean getBoolean(ConfigKey<Boolean> key) { - return Boolean.parseBoolean(getString(key.getKey())); + String value = getString(key.getKey()); + if (value != null) { + return Boolean.parseBoolean(value); + } else { + Boolean defaultValue = key.getDefaultValue(); + return Objects.requireNonNullElse(defaultValue, false); + } } public int getInteger(ConfigKey<Integer> key) { |