XStream
  1. XStream
  2. XSTR-576

Remove <no-comparator/> tag from TreeMap and TreeSet output.

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: Converters
    • Labels:
      None
    • JDK version and platform:
      Sun 1.5_11 under windows

      Description

      I found it strange that a <no-comparator/> tag ended up in the XML for TreeMaps and TreeSets when the comparator itself was null. It seemed to break XStream's "don't include null values" philosophy which makes for more compact XML.

      This patch removes the output of <no-comparator/> while retaining backward compatibility for reading old Tree* XML. It also includes updated test cases for reading XML with the <no-comparator/> for backwards compatibility, reading empty TreeMaps and TreeSets (which are now truly empty), and the various outputs when a comparator is not present.

      The only issue is that now output from this converter will not be compatible with old converters. So if XML is written by this, old versions will not be able to read it.

      It might be a better idea to make this available as an alternative converter which could be added by user preference. I'm not sure how this has been handled in the past, but I'd be willing to break these changes out into a new set of classes and test cases if that is preferred.

      Jason

        Issue Links

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Jason Greanya
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: