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

ConfigurationConverter does not handle CompositeConfiguration correctly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Interpolation
    • Labels:
      None
    • Environment:

      OS X 10.5.5, java version "1.6.0_07", Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)

      Description

      ConfigurationConverter doesn't seem to respect the ordering of a composite configuration. I am having problems describing the behavior, but I thinks the following test case illustrates it best:

      @Test
      public void showBug() {
      PropertiesConfiguration p = new PropertiesConfiguration();
      p.addProperty("foo", "initial");
      p.addProperty("bar", "${foo}");
      p.addProperty("prefix.foo", "override");

      CompositeConfiguration cfg = new CompositeConfiguration();
      cfg.addConfiguration(p.subset("prefix"));
      cfg.addConfiguration(p);

      // this assertion passes as expected since the subset
      // was added first to the composite configuration
      Assert.assertEquals("override", cfg.getString("bar"));

      // after converting to properties, this assertion fails and
      // reports that the value is 'initial'
      Properties properties = ConfigurationConverter.getProperties(cfg);
      Assert.assertEquals("override", properties.getProperty("bar"));
      }

        Attachments

          Activity

            People

            • Assignee:
              oheger Oliver Heger
              Reporter:
              wdemoss William DeMoss II
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: