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

Incomplete interpolation in CompositeConfiguration.getList()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3
    • 1.4
    • None
    • None
    • Any.

    Description

      Interpolsation is mostly done by AbstractConfiguration. All classes that override get methods of AbstractConfiguration need to be careful not to break interpolsation.

      The class CompositeConfiguration overrides getList() to easily chain the results of getList for its subconfigurations. The calls to getList() in the subconfigurations does interpolsation but only inside the subconfiguration. The combined lists never get interpolated in the whole CompositeConfiguration. So whenever a reference in the value refers to a property in another subconfiguration, interpolation breaks.

      Since all the scalar get methods correctly interpolate between different sub configurations, I assume, that this special behavior in getList() is not intended.

      A simple test case would be using the ConfigurationFactory with a config.xml, that uses two property files x.properties:

      x.1=a
      x.2=b

      and y.properties:

      y=${x.1}, ${x.2}

      and then calling getList for the key "y".

      The attached patch fixes the problem locally in CompositeConfiguration. It's not very elegant, but tries to keep the fix local.
      The patch should work for 1.2, 1.3 and trunk, since getList() in CompositeConfiguration ist the same in these versions.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rjung Rainer Jung
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: