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

[configuration] Messed file on saving an XMLConfiguration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • Nightly Builds
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 31429

    Description

      The XMLConfiguration is a configuration based on XML. But when the
      configuration is used to save config properties back into the XML file from
      code, its makes a total mess of the file and doesnt follow basic XML
      conventions.

      If a particular key group already exists, rather than insert new keys there,
      it always just appends new properties to the end of the file. After repeated
      modification, the file becomes an unstructured, unreadable mess. What should
      happen is illustrated below. Starting file:

      <configuration>
      <a>
      <key1>value1</key1>
      </a>
      </configuration>

      Configuration.addProperty("a.key2", "value2") should result in:

      <configuration>
      <a>
      <key1>value1</key1>
      <key2>value2</key2>
      </a>
      </configuration>

      Because of the way setProperty() works, (remove then add), this behaviour also
      results in the same property being moved, it if is modified. So in the example
      above, modifying <key1> would cause it to be moved to the end of file, leaving
      an empty <a> group at the start. Its just unworkable!

      Also, a seperate but releated issue is that a "pretty-print" output format
      would greatly improve developer and user ease-of-use. Currently, there is no
      indenting, so files that are modified by the XMLConfiguration become very hard
      to read/maintain.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ben_hutchison@yahoo.com Ben Hutchison
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: