Title: [2122] trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java: Fix detection of optimized TreeMap.putAll().
Revision
2122
Author
joehni
Date
2013-09-18 17:13:16 -0500 (Wed, 18 Sep 2013)

Log Message

Fix detection of optimized TreeMap.putAll().

Modified Paths


Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java (2121 => 2122)


--- trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java	2013-09-18 21:36:45 UTC (rev 2121)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java	2013-09-18 22:13:16 UTC (rev 2122)
@@ -81,6 +81,7 @@
         map.put("two", null);
         try {
             new TreeMap(comparator).putAll(map);
+            test = true;
         } catch (RuntimeException e) {
             test = false;
         }
@@ -106,20 +107,17 @@
         isSwingAvailable = loadClassForName("javax.swing.LookAndFeel", false) != null;
         isSQLAvailable = loadClassForName("java.sql.Date") != null;
         
-        Class type = null;
+        Class type = PureJavaReflectionProvider.class;
         if (canUseSun14ReflectionProvider()) {
-            type = loadClassForName("com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider");
-            if (type != null) {
+            Class cls = loadClassForName("com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider");
+            if (cls != null) {
                 try {
-                    DependencyInjectionFactory.newInstance(type, null);
+                    DependencyInjectionFactory.newInstance(cls, null);
+                    type = cls;
                 } catch (ObjectAccessException e) {
-                    type = null;
                 }
             }
         }
-        if (type == null) {
-            type = PureJavaReflectionProvider.class;
-        }
         reflectionProviderType = type;
     }
     

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to