Skip to content

Commit

Permalink
Merge pull request #38177 from SIMULATAN/configrecorder-fix-null-valu…
Browse files Browse the repository at this point in the history
…e-check

ConfigRecorder: fix value changed check with null build-time values
  • Loading branch information
gastaldi authored Jan 15, 2024
2 parents 1b7070c + 0ebd47b commit 83a6417
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 83a6417

Please sign in to comment.