Change By: Jörg Schaible (13/Mar/13 6:13 PM)
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)


{code:java}
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"));
}
}
{code}

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to