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

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

    XMLWordPrintableJSON

Details

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

    • 39182

    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.

      Attachments

        Issue Links

          Activity

            People

              oheger Oliver Heger
              oded.noam@adamind.com Oded Noam
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: