Skip to content

improve: config providers for yaml and properties logs only warning on missing file#3245

Open
csviri wants to merge 2 commits intooperator-framework:mainfrom
csviri:config-loader-file
Open

improve: config providers for yaml and properties logs only warning on missing file#3245
csviri wants to merge 2 commits intooperator-framework:mainfrom
csviri:config-loader-file

Conversation

@csviri
Copy link
Collaborator

@csviri csviri commented Mar 19, 2026

This it is easier to handle dynamic configurations coming from a ConfigMap

Signed-off-by: Attila Mészáros a_meszaros@apple.com

Copilot AI review requested due to automatic review settings March 19, 2026 12:33
@openshift-ci openshift-ci bot requested review from metacosm and xstefank March 19, 2026 12:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves error handling in YAML and Properties config providers by changing from throwing an UncheckedIOException when a file doesn't exist to logging a warning and returning empty configuration. This makes the providers more suitable for dynamic configurations sourced from ConfigMaps.

Changes:

  • Modified YamlConfigProvider and PropertiesConfigProvider to check for file existence upfront and return empty collections instead of throwing exceptions
  • Added convenience String-based constructors to both providers that delegate to their Path-based counterparts
  • Added logging to warn when configuration files are missing
  • Updated corresponding tests to verify that missing files now return empty values instead of throwing exceptions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
YamlConfigProvider.java Added file existence check that returns empty Map and logs warning instead of throwing exception; added String constructor
PropertiesConfigProvider.java Added file existence check that returns empty Properties and logs warning instead of throwing exception; added String constructor
YamlConfigProviderTest.java Updated test to verify empty return value for missing file instead of exception
PropertiesConfigProviderTest.java Updated test to verify empty return value for missing file instead of exception

You can also share your feedback on Copilot code review. Take the survey.

@csviri csviri force-pushed the config-loader-file branch 2 times, most recently from 771300d to f8d7205 Compare March 19, 2026 16:40
csviri and others added 2 commits March 20, 2026 08:56
…n missing file

This it is easier to handle dynamic configurations coming from a ConfigMap

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri force-pushed the config-loader-file branch from f8d7205 to 03636ac Compare March 20, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants