poco icon indicating copy to clipboard operation
poco copied to clipboard

ConfigurationView Searches Original Configuration

Open austin-beer opened this issue 7 years ago • 5 comments

As documented by https://docs.pocoproject.org/current/Poco.Util.ConfigurationView.html#:~:text=If%20a%20property%20is%20not%20found%20in%20the%20view%2C%20it%20is%20searched%20in%20the%20original%20configuration.%20Given%20the%20above%20example%20configuration%2C%20the%20property%20named%20%22config.value1%22%20will%20still%20be%20found%20in%20the%20view and as implemented in https://github.com/pocoproject/poco/blob/poco-1.12.2-release/Util/src/ConfigurationView.cpp#L38, ConfigurationView's has*() and get*() functions will search outside of the ConfigurationView in the original configuration if the element being queried isn't present in the ConfigurationView.

Given a configuration with the following properties:

value1 = abc
value2 = def
sub.value3 = ghi
sub.value4 = jkl

If I create a ConfigurationView with the prefix sub and then call has("value1") on that view, the function will return true. I would expect it to return false because sub does not have an element named value1. Similarly, if I call getString("value1") on that view it will return abc instead of throwing a NotFoundException.

While this behavior is documented and while I understand that it was implemented in order to support placeholder expansion, I believe it is unintuitive and often unwanted. As such, I would like to request that either one of the following two solutions be implemented.

  1. Change the current behavior so that the has*() and get*() functions of ConfigurationView behave as one would intuitively expect them to behave, and find another means of continuing to support placeholder expansion.
  2. Provide the ability to change the behavior of ConfigurationView via a setting in the ConfigurationView class, with the documented caveat that changing the behavior may break placeholder expansion.

Thank you.

austin-beer avatar Jan 12 '18 17:01 austin-beer

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Aug 26 '22 03:08 github-actions[bot]

Could someone please take a look at this issue? I believe it is still an issue that should be addressed. Thank you.

austin-beer avatar Aug 30 '22 17:08 austin-beer

@austin-beer your best bet is to do it yourself and send a pull request; I will review it and merge if it is acceptable. Otherwise, I can't promise when will this be addressed

aleks-f avatar Sep 06 '22 08:09 aleks-f

Okay @aleks-f. I won't have time to do that anytime soon, but thank you for responding and letting me know.

austin-beer avatar Sep 06 '22 13:09 austin-beer

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Dec 23 '23 02:12 github-actions[bot]

This issue was closed because it has been inactive for 60 days since being marked as stale.

github-actions[bot] avatar Feb 22 '24 02:02 github-actions[bot]