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

SubnodeConfiguration.clear() does not work correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6
    • 1.7
    • None
    • None

    Description

      If clear() is called on a SubnodeConfiguration obtained through the configurationAt() method of HierarchicalConfiguration, the node structure of the parent configuration (outside of the area of the sub configuration) may also be manipulated. Properties added to the SubnodeConfiguration after a clear() are not visible from the parent configuration.

      The problem is caused by the implementation of the clear() method inherited from AbstractConfiguration. This will call clearProperty() for each property found in the configuration. clearProperty() in turn clears the value of nodes and recursively clears the parent node if it does not contain any data. Here the structure owned by the SubnodeConfiguration can be left so that the parent gets manipulated.

      A possible solution would be to provide a specific implementation of clear() for hierarchical configurations. This could also be more efficient than the base implementation.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              oheger Oliver Heger
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: