Welton Rodrigo Torres Nascimento created SHIRO-817:
------------------------------------------------------
Summary: CommonsInterpolator does not follow javadoc
Key: SHIRO-817
URL: https://issues.apache.org/jira/browse/SHIRO-817
Project: Shiro
Issue Type: Bug
Components: Configuration
Affects Versions: 1.7.1
Reporter: Welton Rodrigo Torres Nascimento
The stated behavior is not the observed.
This is a complement to:
[apache/shiro-site#82|https://github.com/apache/shiro-site/pull/82]
[Relevant code
is|https://github.com/weltonrodrigo/shiro/blob/de3df8699f3dc6d076493c02cd832e0052d05c8b/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/CommonsInterpolator.java#L60]:
The relevant section of the [commons-configuration
class|https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.html]
is:
{quote}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.)
{quote}
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.
As I suppose no one wants to break existing code with the correct behavior, I
think it's better to just update the javadoc. I'll open a pull request with
that.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)