History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-476
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Joerg Schaible
Reporter: Christopher Oezbek
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

PropertiesConverter should sort by key

Created: 08/Feb/08 01:34 AM   Updated: 25/Feb/08 05:02 PM
Component/s: Converters
Affects Version/s: 1.2.2
Fix Version/s: 1.3

JDK version and platform: any


 Description  « Hide
The PropertiesConverter [1] currently serializes its map of key-value entries without ordering them first. Thus the resulting XML may change between runs, which is not very diff-friendly.

A possible solution could look like this (in PropertiesConverter.marshal(...)):

TreeSet s = new TreeSet(properties.keySet());
        
for (Iterator iterator = s.iterator(); iterator.hasNext();) {
    Object key = iterator.next();
    Object value = properties.get(key);

Cheers,
  Christopher

[1] - http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/converters/collections/PropertiesConverter.html

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible - 11/Feb/08 04:00 PM
I've added this as optional functionality. Since the sorting will take time, is unnecessary regarding functionality and may be surprising for existing applications, you may now register a PropertyConverter instance on your own. The head revision supports a bool parameter to enable the sorting.

Joerg Schaible - 25/Feb/08 05:02 PM
Closing issues before next release.