-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#10797 Re-add Try-Catch for ConfigurationExceptions To DefaultPropertyPlaceholderResolver #10798
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…solving env properties
Adding a test case that reproduces this codepath would be good |
I would, but I actually don't know Groovy. Is there any guidance on how to write unit tests for Micronaut? |
You can write the test in java here https://github.com/micronaut-projects/micronaut-core/tree/4.5.x/test-suite/src/test/java/io/micronaut/docs/config/value |
Understood. Writing it now. |
…he placeholder set
…e purposes of the specified unit tests
@graemerocher PR + UTs are ready. |
graemerocher
approved these changes
May 7, 2024
sdelamo
approved these changes
May 8, 2024
sdelamo
added
the
type: regression
A breaking change was introduced in a minor or patch release
label
May 8, 2024
sdelamo
pushed a commit
that referenced
this pull request
May 8, 2024
…laceholderResolver (#10798) Fixes #10797 * Adding try-catch for ConfigurationExceptions which are thrown when resolving env properties * Adding test cases for placeholder resolution, both with and without the placeholder set * Removing irrelevant print statement and method call to vehicle for the purposes of the specified unit tests
sdelamo
pushed a commit
that referenced
this pull request
May 9, 2024
…laceholderResolver (#10798) Fixes #10797 * Adding try-catch for ConfigurationExceptions which are thrown when resolving env properties * Adding test cases for placeholder resolution, both with and without the placeholder set * Removing irrelevant print statement and method call to vehicle for the purposes of the specified unit tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes a regression that was introduced in PR #9701, which removed a try-catch statement within an implementation of the
Segment::findValue()
function.The contract for this interface implies that no exception should be thrown from it, and indeed the default implementation directly catches
ConfigurationException
s and returnsOptional.empty()
.The regression manifests itself as an exception when trying to resolve property placeholders that are expected to be nullable, and thus are not present in the environment or any other property resolver.
Prior behavior simply returned a value of null for these missing and nullable placeholders, which is the expected behavior.
This PR restores this behavior.