Title: [2204] trunk: Fix instantiation of AnnotationMapper that requires ConverterLookup and ConverterRegistry to be the same instance.
Revision
2204
Author
joehni
Date
2013-12-27 12:40:40 -0600 (Fri, 27 Dec 2013)

Log Message

Fix instantiation of AnnotationMapper that requires ConverterLookup and ConverterRegistry to be the same instance. The ConverterLookup used by default cannot be casted to a ConverterRegistry anymore.

Modified Paths

Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/XStream.java (2203 => 2204)


--- trunk/xstream/src/java/com/thoughtworks/xstream/XStream.java	2013-12-23 17:22:32 UTC (rev 2203)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/XStream.java	2013-12-27 18:40:40 UTC (rev 2204)
@@ -462,11 +462,17 @@
     }
     
     private XStream(
-        ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
-        ClassLoaderReference classLoader, Mapper mapper, DefaultConverterLookup defaultConverterLookup) {
-        this(
-            reflectionProvider, driver, classLoader, mapper, defaultConverterLookup,
-            defaultConverterLookup);
+            ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoader,
+            Mapper mapper, final DefaultConverterLookup defaultConverterLookup) {
+        this(reflectionProvider, driver, classLoader, mapper, new ConverterLookup() {
+            public Converter lookupConverterForType(Class type) {
+                return defaultConverterLookup.lookupConverterForType(type);
+            }
+        }, new ConverterRegistry() {
+            public void registerConverter(Converter converter, int priority) {
+                defaultConverterLookup.registerConverter(converter, priority);
+            }
+        });
     }
 
     /**
@@ -567,7 +573,7 @@
             mapper = buildMapperDynamically(ANNOTATION_MAPPER_TYPE, new Class[]{
                 Mapper.class, ConverterRegistry.class, ConverterLookup.class,
                 ClassLoaderReference.class, ReflectionProvider.class}, new Object[]{
-                mapper, converterLookup, converterLookup, classLoaderReference,
+                mapper, converterRegistry, converterLookup, classLoaderReference,
                 reflectionProvider});
         }
         mapper = wrapMapper((MapperWrapper)mapper);

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


--- trunk/xstream-distribution/src/content/changes.html	2013-12-23 17:22:32 UTC (rev 2203)
+++ trunk/xstream-distribution/src/content/changes.html	2013-12-27 18:40:40 UTC (rev 2204)
@@ -64,6 +64,8 @@
     
     <ul>
    		<li>java.bean.EventHandler no longer handled automatically because of severe security vulnerability.</li>
+   		<li>Fix instantiation of AnnotationMapper that requires ConverterLookup and ConverterRegistry to be the same
+   		instance.</li>
     </ul>
 
     <h2>Minor changes</h2>
@@ -72,6 +74,7 @@
    		<li>XSTR-749: NPE if ReflectionConverter.canConvert(type) is called with null as argument.</li>
    		<li>Add constructor to ReflectionConverter taking an additional type to create an instance that is
    		dedicated to a specific type only.</li>
+   		<li>The ConverterLookup used by default cannot be casted to a ConverterRegistry anymore.</li>
     </ul>
 
     <h2>API changes</h2>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to