aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/config/Config.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-05-04 19:35:52 -0700
committerAnton Tananaev <anton@traccar.org>2024-05-04 19:35:52 -0700
commitc2993f0451749f3b127aa64892eb3db60360a4b6 (patch)
tree8941c924381aa7a3b31b4384667bbcff09369946 /src/main/java/org/traccar/config/Config.java
parent93828126208b569b360fedecb1e87b4ed809b298 (diff)
downloadtrackermap-server-c2993f0451749f3b127aa64892eb3db60360a4b6.tar.gz
trackermap-server-c2993f0451749f3b127aa64892eb3db60360a4b6.tar.bz2
trackermap-server-c2993f0451749f3b127aa64892eb3db60360a4b6.zip
Support true as boolean default
Diffstat (limited to 'src/main/java/org/traccar/config/Config.java')
-rw-r--r--src/main/java/org/traccar/config/Config.java8
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) {