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

XMLConfiguration with setAutoSave(true) doesn't save if SubnodeConfiguration is changed

    XMLWordPrintableJSON

    Details

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

      Description

      config.xml file
      <conf>
      <parent-item>
      <sub-item>old_value</sub-item>
      </parent-item>
      </conf>

      The problem can be reproduced as follows:

      1 XMLConfiguration config = new XMLConfiguration("c:
      conf.xml");
      2 config.setAutoSave(true) ;
      3 SubnodeConfiguration parentItemConfig = config.configurationAt("parent-item");
      4 parentItemConfig.setProperty("sub-item","new_value");
      5. System.out.println(config.getString("parent-item.sub-item"); // will print new_value
      // if you look at the config.xml sub-item still has old_value

      // also if you try to do
      5 XMLConfiguration config2 = new XMLConfiguration("c:
      conf.xml");
      6. System.out.println(config2.getString("parent-item.sub-item"); // will print old_value

        Attachments

          Activity

            People

            • Assignee:
              oheger Oliver Heger
              Reporter:
              irina Irina Fridkina
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: