You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Marco Di Falco (Jira)" <ji...@apache.org> on 2021/05/11 05:44:00 UTC

[jira] [Comment Edited] (CONFIGURATION-807) Method addProperty don't work if the property not exist in the file

    [ https://issues.apache.org/jira/browse/CONFIGURATION-807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17342305#comment-17342305 ] 

Marco Di Falco edited comment on CONFIGURATION-807 at 5/11/21, 5:43 AM:
------------------------------------------------------------------------

Hi Oliver

Thank you so much!
 Now work . I do this:
 !image-2021-05-11-07-41-57-998.png!
 And work!
I close the Jira
 Good day!


was (Author: vega883):
Hi Oliver

Thank you so much!
Now work . I do this:
!image-2021-05-11-07-41-57-998.png!
And work!
Close the Jira
Good day!

> Method addProperty don't work if the property not exist in the file
> -------------------------------------------------------------------
>
>                 Key: CONFIGURATION-807
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-807
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.7
>            Reporter: Marco Di Falco
>            Priority: Major
>         Attachments: image-2021-05-07-12-06-03-339.png, image-2021-05-07-12-09-33-450.png, image-2021-05-11-07-41-57-998.png
>
>
> 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:
> {code:java}
> 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));
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)