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

HierarchicalConfiguration.clearTree() does not remove named property

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      HierarchicalConfiguration.clearTree(String) calls HierarchicalConfiguration.removeNode(ConfigurationNode) which removes nothing if the passed in ConfigurationNode has no parent. Having no parent is true of nodes that have the root for their parent (it seems to me) as well as for nodes that have no properties defined "above" them. Here is an example:

      config.addProperty("a.b.c", "c");
      config.addProperty("a.b.c.d", "d");
      config.addProperty("a.b.c.d.e", "e");

      The following sequence of calls will fail:
      config.clearTree("a.b.c");
      assert config.containsKey("a.b.c") == false;

      The following sequence of calls will succeed:
      config.clearTree("a.b.c.d");
      assert config.containsKey("a.b.c.d") == false;
      assert config.containsKey("a.b.c.d.e") == false;

        Attachments

        1. bug-test.properties
          0.0 kB
          Wesley Miaw
        2. bug-override.xml
          0.1 kB
          Wesley Miaw
        3. bug-config.xml
          0.2 kB
          Wesley Miaw

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              josuah Wesley Miaw
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: