Peter created CONFIGURATION-753:

             Summary: Handling of interpolation is inconsistant
                 Key: CONFIGURATION-753
             Project: Commons Configuration
          Issue Type: Bug
          Components: Interpolation
    Affects Versions: 2.5
         Environment: Java 8, Configurations2 2.5
            Reporter: Peter

If a key is repeated in a configuration and then used in an interpolation else 
where, the behaviour is inconsistent. There are other tickets/discussions about 
whether it should just pick the first value or not, but I don't think it should 
do both.

abc = hello
abc = world = ${abc}
foo.two = prefix ${abc} suffix

{ (main)}
Parameters params = new Parameters();
FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new 
try {
    FileBasedConfiguration config = builder.getConfiguration();
} catch (ConfigurationException cex) {
    // pass

The output from the above is 
prefix [hello, world] suffix

In the first case, only the first value is being matched, in the second both 
values (and [, ]) are used.

I'd expect the output to either be
{noformat:title=First value only}
prefix hello suffix


{noformat:title=Both values used}
[hello, world]
prefix [hello, world] suffix

I can work around whichever style is chosen but think it'd be much more 
intuitive if both cases were handled the same.

This message was sent by Atlassian JIRA

Reply via email to