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

[configuration] ConfigurationConverter.getProperties() and interpolate behaviour inconsequent with getList()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 36784

    Description

      Hi,

      when converting a Configuration object into a Properties object no variable
      interpolation takes place. E.g. you have a PropertiesConfiguration with:
      foo=bar
      interpolated=${foo}

      If you dump the Properties object or use .getProperty("interpolated") you will
      get "${foo}" instead of "bar".
      If you convert the Configuration one would expect the real/interpolated values
      for use with a legacy method (or just any JDK method that just takes Properties).

      But as the converter uses Configuration.getList(key) that doesn't interpolate
      (why does getList not interpolate?) this doesn't happen. Probably one could just
      use getStringArray() instead as this method does interpolate.
      Is there a reason for AbstractConfiguration.getStringArray() working differently
      compared to getList() with regard to variable interpolation? At least a Javadoc
      note would be good, or did one just forget to call "interpolate" in both?

      Moreover it would be logical if getProperties() & related methods would allow to
      specify a separator char as ", " is nice to print but is more difficult to parse
      than just ",". Actually the AbstractConfiguration.setDelimiter() functionality
      would make it reasonable to allow the user to modify the default also when
      converting vice versa.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mech@tngtech.com Michael Echerer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: