XStream
  1. XStream
  2. XSTR-476

PropertiesConverter should sort by key

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.3
    • Component/s: Converters
    • Labels:
      None
    • JDK version and platform:
      any

      Description

      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

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Christopher Oezbek
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: