Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-104

[configuration] Preserve file structure (line comments) when re-saving properties file

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      This bug applies when an application allows both manual editing of its
      configuration files, and manipulation of the configuration via software. When
      saving the configuration file after changing, its file structure - file,
      section and line comments - will all be lost. Next time a human tries to edit
      the configuration file, all property documentation will be lost.

      I have created a fix for this problem, applicable to PropertiesConfiguration
      and XMLPropertiesConfiguration. The fix allows these classes to preserve a
      list of comment lines preceding each property line. By default, comments are
      not preserved; in case the comment preservation is required, it should be
      enabled prior to loading the configuration file using:

      AbstractFileConfiguration.setDefaultPreserveComments(true);

      The fix is implemented and tested, attached as a patch file to this bug.

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Oliver Heger
              Reporter:
              Oded Noam
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development