You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jamie Guillemette <JM...@hotmail.com> on 2005/04/06 13:47:54 UTC

[configuration] - save not working..?

Hi Guys,

Was playing with the commons-configuration project last night and for the life of me was unable to successfully save configuration changes. No exceptions are thrown but the data physically remains unchanged in the properties file.

[code]

public void set(Object value)throws ConfigurationException {
  config.setProperty("name.first",value);
  config.save();
  config.reload();
 }

[/code]

where config is : private PropertiesConfiguration config;
that is successuflly loaded and returns values from the properties file using

[code]
public Object get() {
  return config.getString("name.first"); 
 }
[/code]

Anyone know if this is a know bug ?

Thanks
J.

Re: [configuration] - save not working..?

Posted by Jamie Guillemette <JM...@hotmail.com>.
Hey Emmanuel,

here is how i load the config.

[code]
public PropertiesConfiguration loadPropertyConfiguration(String 
configFileName)throws ConfigurationException{
  URL configURL = this.getClass().getResource(configFileName);
  return  new PropertiesConfiguration(configURL);
 }
[/code]


----- Original Message ----- 
From: "Emmanuel Bourg" <eb...@apache.org>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Wednesday, April 06, 2005 7:59 AM
Subject: Re: [configuration] - save not working..?


> Hi Jamies, could you show us how the configuration is loaded ?
>
> Emmanuel Bourg
>
>
> Jamie Guillemette wrote:
>> Hi Guys,
>>
>> Was playing with the commons-configuration project last night and for the 
>> life of me was unable to successfully save configuration changes. No 
>> exceptions are thrown but the data physically remains unchanged in the 
>> properties file.
>>
>> [code]
>>
>> public void set(Object value)throws ConfigurationException {
>>   config.setProperty("name.first",value);
>>   config.save();
>>   config.reload();
>>  }
>>
>> [/code]
>>
>> where config is : private PropertiesConfiguration config;
>> that is successuflly loaded and returns values from the properties file 
>> using
>>
>> [code]
>> public Object get() {
>>   return config.getString("name.first"); }
>> [/code]
>>
>> Anyone know if this is a know bug ?
>>
>> Thanks
>> J.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [configuration] - save not working..?

Posted by Emmanuel Bourg <eb...@apache.org>.
Hi Jamies, could you show us how the configuration is loaded ?

Emmanuel Bourg


Jamie Guillemette wrote:
> Hi Guys,
> 
> Was playing with the commons-configuration project last night and for the life of me was unable to successfully save configuration changes. No exceptions are thrown but the data physically remains unchanged in the properties file.
> 
> [code]
> 
> public void set(Object value)throws ConfigurationException {
>   config.setProperty("name.first",value);
>   config.save();
>   config.reload();
>  }
> 
> [/code]
> 
> where config is : private PropertiesConfiguration config;
> that is successuflly loaded and returns values from the properties file using
> 
> [code]
> public Object get() {
>   return config.getString("name.first"); 
>  }
> [/code]
> 
> Anyone know if this is a know bug ?
> 
> Thanks
> J.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org