ConfigRecorder: fix value changed check with null build-time values #38177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for a bug I encountered in production where the whole application would crash with a cryptic message:
After remote debugging it, I found the problem to be the particular line I changed. The bug occurs when a build-time property is null as it tries to call
equals
on this value to check for runtime config changes.One case in which this happens is when environment variables that aren't set are used in a config value. In particular, using, say,
$POSTGRES_USER
as a variable in%prod.quarkus.datasource.url
causes the build-time value to evaluate tonull
withrawValue
being the property without the variables substituted.This PR changes the logic to use
Objects.equals
which is null safe. If the build-time value isnull
, it'll detect it as a change (as long as the runtime value isn'tnull
too)Note for maintainers: the commit is unsigned as I recently changed my email and haven't updated my PGP key. Squash merge the PR to sign the commit with GitHub's key