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 Summary: ConfigurationFactory auto save overwrites properties file. Product: Commons Version: 1.1.0 Platform: Other OS/Version: other Status: NEW Severity: normal Priority: P2 Component: Configuration AssignedTo: commons-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Setting a PropertiesConfiguration autoSave=true via a ConfigurationFactory can cause the underlying properties file to be completely overwritten. Example: config.xml: <?xml version="1.0" encoding="ISO-8859-1" ?> <configuration> <properties fileName="application.properties" /> <properties fileName="ui.properties" autoSave="true"/> </configuration> application.properties: application.name=Test App application.version = 0.01 application.title = ${application.name} V${application.version} ui.properties: ui.test="stuff here" Execute the code: ConfigurationFactory factory = new ConfigurationFactory(); URL configURL = getClass().getResource("/config.xml"); factory.setConfigurationURL(configURL); try { config = factory.getConfiguration(); System.out.println(config.getString("application.title")); System.out.println(config.getString("ui.test")); config.setProperty("ui.test", "will this get saved ?"); System.out.println(config.getString("ui.test")); } catch (ConfigurationException e) { e.printStackTrace(); } Program output: 12/04/2005 10:24:00 org.apache.commons.configuration.ConfigurationFactory$FileConfigurationFactory createObject INFO: Trying to load configuration application.properties 12/04/2005 10:24:00 org.apache.commons.configuration.ConfigurationFactory$FileConfigurationFactory createObject INFO: Trying to load configuration ui.properties Test App V0.01 "stuff here" will this get saved ? After execution --------------- application.properties: application.name=Test App application.version = 0.01 application.title = ${application.name} V${application.version} ui.properties: # written by PropertiesConfiguration # Tue Apr 12 10:24:00 EST 2005 NOTE ui.test doesn't appear with either the old value or the modified one. -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]