From c2993f0451749f3b127aa64892eb3db60360a4b6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 4 May 2024 19:35:52 -0700 Subject: Support true as boolean default --- src/main/java/org/traccar/config/Config.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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 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 key) { -- cgit v1.2.3