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

Method addProperty don't work if the property not exist in the file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.7
    • None
    • None
    • None
    • Important

    Description

      The method addProperty not append a NEW property in the file when the property not exist.
      I work with java 7.
      I see that the new property don't compare in keys list, and when the property is new.

      Example:

      PropertiesConfiguration config = new PropertiesConfiguration();
      PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout(); 
      layout.load(config, new InputStreamReader(new FileInputStream(zookeeper))); 
      String port = instance.getPort();
      
      config.setProperty("clientPort", port); 
      config.addProperty("prova","prova"); 
      layout.save(config, new FileWriter(zookeeper));
      

      The property 'prova' don't appear in the file property after the save.

      I see in PropertiesConfigurationLayout.save, line 565, that the method  'getKeys' don't contain the property 'prova', and the save lost this property.

      Attachments

        1. image-2021-05-11-07-41-57-998.png
          38 kB
          Marco Di Falco
        2. image-2021-05-07-12-09-33-450.png
          32 kB
          Marco Di Falco
        3. image-2021-05-07-12-06-03-339.png
          125 kB
          Marco Di Falco

        Activity

          People

            Unassigned Unassigned
            vega883 Marco Di Falco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: