commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31429] New: - Saving properties to XMLConfiguration creates mess in the save file
Date Mon, 27 Sep 2004 01:27:36 GMT
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=31429>.
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=31429

Saving properties to XMLConfiguration creates mess in the save file

           Summary: Saving properties to XMLConfiguration creates mess in
                    the save file
           Product: Commons
           Version: 1.0 Beta 2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Configuration
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ben_hutchison@yahoo.com


The XMLConfiguration is a configuration based on XML. But when the 
configuration is used to save config properties back into the XML file from 
code, its makes a total mess of the file and doesnt follow basic XML 
conventions. 

If a particular key group already exists, rather than insert new keys there, 
it always just appends new properties to the end of the file. After repeated 
modification, the file becomes an unstructured, unreadable mess. What should 
happen is illustrated below. Starting file:

<configuration>
  <a>
     <key1>value1</key1>
  </a>
</configuration>

Configuration.addProperty("a.key2", "value2") should result in:

<configuration>
  <a>
     <key1>value1</key1>
     <key2>value2</key2>
  </a>
</configuration>

Because of the way setProperty() works, (remove then add), this behaviour also 
results in the same property being moved, it if is modified. So in the example 
above, modifying <key1> would cause it to be moved to the end of file, leaving 
an empty <a> group at the start. Its just unworkable! 


Also, a seperate but releated issue is that a "pretty-print" output format 
would greatly improve developer and user ease-of-use. Currently, there is no 
indenting, so files that are modified by the XMLConfiguration become very hard 
to read/maintain.

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


Mime
View raw message