[
https://issues.apache.org/jira/browse/CONFIGURATION-807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marco Di Falco updated CONFIGURATION-807:
-----------------------------------------
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:
{code:java}
PropertiesConfiguration config = new PropertiesConfiguration();{code}
{code:java}
PropertiesConfiguration config = new PropertiesConfiguration();
PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout();
layout.load(config, new InputStreamReader(new FileInputStream(zookeeper)));
{code}
{code:java}
String port = instance.getPort();
{code}
{code:java}
config.setProperty("clientPort", port); {code}
{code:java}
config.addProperty("prova","prova"); {code}
{code:java}
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.
was:
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}
Segnaposto codice //{code}
{code:java}
PropertiesConfiguration config = new PropertiesConfiguration();{code}
{code:java}
PropertiesConfiguration config = new PropertiesConfiguration();
PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout();
layout.load(config, new InputStreamReader(new FileInputStream(zookeeper)));
{code}
{code:java}
String port = instance.getPort();
{code}
{code:java}
config.setProperty("clientPort", port); {code}
{code:java}
config.addProperty("prova","prova"); {code}
{code:java}
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.
> 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
>
> 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();{code}
> {code:java}
> PropertiesConfiguration config = new PropertiesConfiguration();
> PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout();
> layout.load(config, new InputStreamReader(new FileInputStream(zookeeper)));
> {code}
> {code:java}
> String port = instance.getPort();
> {code}
> {code:java}
> config.setProperty("clientPort", port); {code}
> {code:java}
> config.addProperty("prova","prova"); {code}
> {code:java}
> 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)