Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-734

Inconsistent/strange configuration keys for attributes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Given the following configuration-1.xml:

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

      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 DefaultListDelimiterHandler(',')));
                  XMLConfiguration configuration = builder.getConfiguration();

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

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

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

      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.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            hchen00 Hao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: