Title: [2007] trunk: Fields not found when XStream12FieldKeySorter used (XSTR-714).

Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java (2006 => 2007)


--- trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java	2013-01-15 23:49:50 UTC (rev 2006)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java	2013-01-18 15:39:51 UTC (rev 2007)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Joe Walnes.
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 XStream Committers.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 XStream Committers.
  * All rights reserved.
  *
  * The software in this package is published under the terms of the BSD
@@ -112,7 +112,7 @@
     public Field fieldOrNull(Class cls, String name, Class definedIn) {
         Map fields = buildMap(cls, definedIn != null);
         Field field = (Field)fields.get(definedIn != null
-            ? (Object)new FieldKey(name, definedIn, 0)
+            ? (Object)new FieldKey(name, definedIn, -1)
             : (Object)name);
         return field;
     }

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java (2006 => 2007)


--- trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java	2013-01-15 23:49:50 UTC (rev 2006)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java	2013-01-18 15:39:51 UTC (rev 2007)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008 XStream Committers.
+ * Copyright (C) 2007, 2008, 2013 XStream Committers.
  * All rights reserved.
  *
  * The software in this package is published under the terms of the BSD
@@ -38,7 +38,9 @@
             }
         });
         map.putAll(keyedByFieldKey);
-        return map;
+        keyedByFieldKey.clear();
+        keyedByFieldKey.putAll(map);
+        return keyedByFieldKey;
     }
 
 }

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/core/util/OrderRetainingMap.java (2006 => 2007)


--- trunk/xstream/src/java/com/thoughtworks/xstream/core/util/OrderRetainingMap.java	2013-01-15 23:49:50 UTC (rev 2006)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/core/util/OrderRetainingMap.java	2013-01-18 15:39:51 UTC (rev 2007)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2005 Joe Walnes.
- * Copyright (C) 2006, 2007 XStream Committers.
+ * Copyright (C) 2006, 2007, 2013 XStream Committers.
  * All rights reserved.
  *
  * The software in this package is published under the terms of the BSD
@@ -33,10 +33,7 @@
 
     public OrderRetainingMap(Map m) {
         super();
-        for (final Iterator iter = m.entrySet().iterator(); iter.hasNext();) {
-            final Map.Entry entry = (Map.Entry)iter.next();
-            put(entry.getKey(), entry.getValue());
-        }
+        putAll(m);
     }
 
     public Object put(Object key, Object value) {
@@ -59,6 +56,12 @@
         return super.remove(key);
     }
 
+    public void clear() {
+        keyOrder.clear();
+        valueOrder.clear();
+        super.clear();
+    }
+
     public Collection values() {
         return Collections.unmodifiableList(valueOrder);
     }

Modified: trunk/xstream-distribution/src/content/changes.html (2006 => 2007)


--- trunk/xstream-distribution/src/content/changes.html	2013-01-15 23:49:50 UTC (rev 2006)
+++ trunk/xstream-distribution/src/content/changes.html	2013-01-18 15:39:51 UTC (rev 2007)
@@ -48,6 +48,7 @@
     	<li>JIRA:XSTR-708: SqlTimestampConverter does not ignore timezone.</li>
     	<li>JIRA:XSTR-707: Creation of XmllPullParser with the XmlPullParserFactory may fail in OSGi environment.</li>
     	<li>JIRA:XSTR-705: Unnecessary synchronization accessing the field cache decreases performance.</li>
+    	<li>JIRA:XSTR-714: Fields not found when XStream12FieldKeySorter used.</li>
     </ul>
 
     <h2>API changes</h2>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to