Details
-
Type: Bug
-
Status: Closed
-
Priority: Blocker
-
Resolution: Not A Bug
-
Affects Version/s: 1.3.1
-
Fix Version/s: None
-
Component/s: Compatibility
-
Labels:None
Description
Following Source code shows problem.
When deserializing TreeMap - value is not found (key LPT2)
When you change order of <entry> to COM1 LPT1 LPT2 LPT3 LPT4 it works just fine.
Other JREs works fine with any <entry> order (Sun 1.6 Jrockit 1.4 ...)
This makes XStream unreliable for Jrockit (I used 1.6.0_20-b02)
import java.util.Map; import com.thoughtworks.xstream.XStream; public class XstreamTest { public static void main(String[] args) { String xml = "" + " <tree-map>\r\n" + " <no-comparator/>\r\n" + " <entry>\r\n" + " <string>LPT1</string>\r\n" + " <string>Zebra 105SL (8dpmm~200dpi)</string>\r\n" + " </entry>\r\n" + " <entry>\r\n" + " <string>LPT2</string>\r\n" + " <string>Zebra 105SL (8dpmm~200dpi)</string>\r\n" + " </entry>\r\n" + " <entry>\r\n" + " <string>LPT3</string>\r\n" + " <string>Zebra 105SL (8dpmm~200dpi)</string>\r\n" + " </entry>\r\n" + " <entry>\r\n" + " <string>LPT4</string>\r\n" + " <string>Zebra 105SL (8dpmm~200dpi)</string>\r\n" + " </entry>\r\n" + " <entry>\r\n" + " <string>COM1</string>\r\n" + " <string>Zebra 105SL (8dpmm~200dpi)</string>\r\n" + " </entry>\r\n" + " </tree-map>\r\n" + ""; XStream xs = new XStream(); Map map = (Map) xs.fromXML(xml); System.out.println(map.get("LPT2")); } }
Result of this code should be "Zebra 105SL (8dpmm~200dpi)"
but it is "null"