[
https://issues.apache.org/jira/browse/CONFIGURATION-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114880#comment-15114880
]
Alex Lopashev edited comment on CONFIGURATION-617 at 1/25/16 11:32 AM:
-----------------------------------------------------------------------
I guess you can agree such interpolation of array/collection to only first
element is broken. There are several approaches for solution:
# Support array/collection return type for {{resolveContainerStore}} as it's
already returning {{Object}}. This one is heavy and error-prone.
# Joining values with delimiter into one string and add splitting value
somewhere at the last step of evaluation. This seems just not right approach
and source for subtle bugs.
# Do nothing and treat such behavior as expected. This option is ok if
array/container processing would be turned off by default, right now it's on
and uses comma (most natural symbol for enumeration) as delimiter
So this is feature request for disabling multi-valued properties by default and
treat strings with commas just like any other strings
({{AbstractConfiguration#delimiterParsingDisabled[=true]}}).
was (Author: alexlopashev):
I guess you can agree such interpolation of array/collection to only first
element is broken. There are several approaches for solution:
# Support array/collection return type for {{resolveContainerStore}} as it's
already returning {{Object}}. This one is heavy and error-prone.
# Joining values with delimiter into one string and add splitting value
somewhere at the last step of evaluation. This seems just not right approach
and source for subtle bugs.
# Do nothing and treat such behavior as expected. This option is ok if
array/container processing would be turned off by default, right now it's on
and uses comma (most natural symbol for enumeration) as delimiter
So this is feature request for disabling multi-valued properties by default
({{AbstractConfiguration#delimiterParsingDisabled[=true]}}) and treat strings
with commas just like any other strings.
> Incorrect multi-valued property substitution
> --------------------------------------------
>
> Key: CONFIGURATION-617
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-617
> Project: Commons Configuration
> Issue Type: Bug
> Components: Interpolation
> Affects Versions: 1.10
> Reporter: Alex Lopashev
>
> According to
> [AbstractConfiguration#resolveContainerStore|http://grepcode.com/file/repo1.maven.org/maven2/commons-configuration/commons-configuration/1.10/org/apache/commons/configuration/AbstractConfiguration.java#AbstractConfiguration.resolveContainerStore%28java.lang.String%29]
> code and documentation it uses only first value if array/collection property
> value.
> Such behavior is broken in a trivial situation:
> {{a=1,2,3}}
> {{b=$\{a\} ⇒ b=1}}
> The solution will be to stop using logic in {{resolveContainerStore(key)}}
> and just use {{getProperty(key)}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)