DO NOT REPLY [Bug 34410] - [configuration] ConfigurationFactory auto save overwrites properties file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DO NOT REPLY [Bug 34410] - [configuration] ConfigurationFactory auto save overwrites properties file

Bugzilla from bugzilla@apache.org
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG?
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34410>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND?
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34410





------- Additional Comments From [hidden email]  2005-05-07 17:41 -------
The following seems to happen:

PropertiesConfiguration.load() loads the specified properties file line by line
and calls addProperty() for each detected property. In
AbstractFileConfiguration.addProperty() the new property value is stored and
then possiblySave() is called. If the auto save flag is set, this method will
trigger the save() method, which in turn will immediately overwrite the current
configuration file.

As a solution I suggest to store the old value of the auto save flag at the
beginning of PropertiesConfiguration.load() and set it always to false. At the
end of the method (in a finally block) the flag's old value can be reset.

autoSave really should not be enabled during execution of a load method. So it
might be better to implement such a mechanism already in
AbstractFileConfiguration (but where?). Any thoughts or comments?

--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]