Skip to content
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

[SHIRO-817] Update CommonsInterpolator doc to reflect actual behavior #302

Merged
merged 2 commits into from
May 27, 2021
Merged

[SHIRO-817] Update CommonsInterpolator doc to reflect actual behavior #302

merged 2 commits into from
May 27, 2021

Conversation

weltonrodrigo
Copy link
Contributor

The stated behavior is not the observed.

This is a complement to: apache/shiro-site#82

The relevant section of the commons-configuration class is:

After an instance has been created it does not contain any Lookup objects. The current set of lookup objects can be modified using the registerLookup() and deregisterLookup() methods. Default lookup objects (that are invoked for variables without a prefix) can be added or removed with the addDefaultLookup() and removeDefaultLookup() methods respectively. (When a ConfigurationInterpolator instance is created by a configuration object, a default lookup object is added pointing to the configuration itself, so that variables are resolved using the configuration's properties.)

So, the correct behavior is that you can use ${const:java.awt.event.KeyEvent.VK_ENTER} but not ${env:EDITOR}. The current code accepts ${EDITOR}. If a system property with this name is found not null, it is used, if not, an environment variable is search and if not, the whole substitution ${EDITOR} is returned.

The stated behavior is not the observed.

This is a complement to: apache/shiro-site#82

The relevant section of the commons-configuration class is:

> After an instance has been created *it does not contain any Lookup objects*. The current set of lookup objects can be modified using the registerLookup() and deregisterLookup() methods. *Default lookup objects (that are invoked for variables without a prefix)* can be added or removed with the addDefaultLookup() and removeDefaultLookup() methods respectively. (When a ConfigurationInterpolator instance is created by a configuration object, a default lookup object is added pointing to the configuration itself, so that variables are resolved using the configuration's properties.)

So, the correct behavior is that you can use `${const:java.awt.event.KeyEvent.VK_ENTER}` but not `${env:EDITOR}`.  The current code accepts `${EDITOR}`. If a system property with this name is found not null, it is used, if not, an environment variable is search and if not, the whole substitution `${EDITOR}` is returned.
@bmarwell bmarwell requested a review from bdemers May 18, 2021 15:24
Copy link
Member

@bdemers bdemers left a comment

Choose a reason for hiding this comment

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

Thanks!

@bdemers bdemers merged commit 1c97815 into apache:main May 27, 2021
@weltonrodrigo weltonrodrigo deleted the patch-1 branch June 8, 2022 11:48
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.

3 participants