config manager: treat null and empty string equally in setDefaultConfiguration
The config manager treats null and empty string as equal and will unset config values which are set to the empty string with the config client. This fixes the config manager applying default config values which are the empty string when the current value is null, causing it to send an unnecessary unset request
This commit is contained in:
@@ -523,7 +523,10 @@ public class ConfigManager
|
||||
|
||||
String current = getConfiguration(group.value(), item.keyName());
|
||||
String valueString = objectToString(defaultValue);
|
||||
if (Objects.equals(current, valueString))
|
||||
// null and the empty string are treated identically in sendConfig and treated as an unset
|
||||
// If a config value defaults to "" and the current value is null, it will cause an extra
|
||||
// unset to be sent, so treat them as equal
|
||||
if (Objects.equals(current, valueString) || (Strings.isNullOrEmpty(current) && Strings.isNullOrEmpty(valueString)))
|
||||
{
|
||||
continue; // already set to the default value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user