commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hao Chen (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-734) Inconsistent/strange configuration keys for attributes
Date Mon, 07 Jan 2019 07:41:00 GMT
Hao Chen created CONFIGURATION-734:

             Summary: Inconsistent/strange configuration keys for attributes
                 Key: CONFIGURATION-734
             Project: Commons Configuration
          Issue Type: Bug
            Reporter: Hao Chen

Given the following configuration-1.xml:

    <node type="test" types="a,b,c"/>

If you get the configuration using something like:

            Parameters params = new Parameters();
            ReloadingFileBasedConfigurationBuilder<XMLConfiguration> builder
= new ReloadingFileBasedConfigurationBuilder<XMLConfiguration>(XMLConfiguration.class);
            builder.configure(params.xml().setFile("configuration-1.xml ").setListDelimiterHandler(new
            XMLConfiguration configuration = builder.getConfiguration();

Then you print the keys using configuration.getKeys(), you will get something like: node[@type],

However, if you use a combined configuration.xml like:

    <xml fileName="configuration-1.xml" reloadingRefreshDelay="10000" config-name="config3"
config-optional="false" throwExceptionOnMissing="false"/>

And you get the configuration using:

            Parameters params = new Parameters();
            ReloadingCombinedConfigurationBuilder builder = new ReloadingCombinedConfigurationBuilder();
            builder.configure(params.fileBased().setFile(new File("configuration.xml
")).setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
            CombinedConfiguration configuration = builder.getConfiguration();

Then when you print the configuration keys, you will get something like: node/@type, node/@types
- this format seems to be the standard one and keys in the above example look very strange.



This message was sent by Atlassian JIRA

View raw message