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

Variable interpolation across files broken in 1.7 & 1.8

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7, 1.8
    • Fix Version/s: 1.9
    • Component/s: Interpolation
    • Labels:
      None
    • Environment:

      Any OS, but have verified with Windows 7 and AIX 6.1, running Java 1.6.0.

      Description

      With Commons Configuration 1.6, I was able to declare a variable in a properties file, and then reference it in a XML file using the ${myvar} syntax.

      For example:

      global.properties:

      myvar=abc

      test.xml:

      <products>
        <product name="abc">
          <desc>${myvar}-product</desc>
        </product>
      </products>
      

      config.xml:

      <properties fileName="global.properties"/>
      <xml fileName="test.xml" config-name="test">
        <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
      </xml>
      

      When I try to retrieve the value, like so:

      combinedConfig.getConfiguration("test").configurationAt("products/product[@name='abc']", true).getString("desc")

      I get "${myvar}-product" instead of "abc-product".

      This was working in Commons Configuration 1.6, but seems to be broken in 1.7 and 1.8.

        Attachments

        1. ApacheBug-CONFIGURATION-481.7z
          2.49 MB
          Jim Prantzalos

          Activity

            People

            • Assignee:
              oheger Oliver Heger
              Reporter:
              dprantzalos Jim Prantzalos
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: