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

PropertiesConfiguration dysfunctional if constructed with nonexistent File

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Component/s: Events & Notifications
    • Labels:
      None

      Description

      When PropertiesConfiguration is constructed around a File that does not exist, everything seemingly goes well, but saving the configuration only results in an empty file. This differs from constructing a PropertiesConfiguration around a file name passed as String, which appropriately fails at construction-time, since it tries to load() the configuration, which fails.

      When the nonexistent configuration file is passed as File, this does not happen, since the File constructor in AbstractFileConfiguration specifically tests if the file exists before calling load() and succeeds even if it wasn't called. However, if load() is not called, no PropertiesConfigurationLayout is created or registered to the EventSource, and thus nothing is saved when save() is called on the PropertiesConfiguration. Calling save() actually calls getLayout(), which creates a layout and registers it, but the properties set between construction of the PropertiesConfiguration and calling save() on it are still lost.

        Attachments

          Activity

            People

            • Assignee:
              oheger Oliver Heger
              Reporter:
              tazle Tuure Laurinolli
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: