Skip to content

Commit

Permalink
ConfigRecorder: fix value changed check with null build-time values
Browse files Browse the repository at this point in the history
(cherry picked from commit 0ebd47b)
  • Loading branch information
SIMULATAN authored and gsmet committed Jan 15, 2024
1 parent 91f3111 commit 20d566c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

import org.eclipse.microprofile.config.ConfigProvider;
Expand Down Expand Up @@ -42,7 +43,8 @@ public void handleConfigChange(Map<String, ConfigValue> buildTimeRuntimeValues)
for (Map.Entry<String, ConfigValue> entry : buildTimeRuntimeValues.entrySet()) {
ConfigValue currentValue = config.getConfigValue(entry.getKey());
// Check for changes. Also, we only have a change if the source ordinal is higher
if (currentValue.getValue() != null && !entry.getValue().getValue().equals(currentValue.getValue())
// The config value can be null (for ex. if the property uses environment variables not available at build time)
if (currentValue.getValue() != null && !Objects.equals(entry.getValue().getValue(), currentValue.getValue())
&& entry.getValue().getSourceOrdinal() < currentValue.getSourceOrdinal()) {
mismatches.add(
" - " + entry.getKey() + " is set to '" + currentValue.getValue()
Expand Down

0 comments on commit 20d566c

Please sign in to comment.