Title: [2159] trunk: Added static method canCreateDerivedObjectOutputStream to JVM.
Revision
2159
Author
joehni
Date
2013-11-26 19:38:00 -0600 (Tue, 26 Nov 2013)

Log Message

Added static method canCreateDerivedObjectOutputStream to JVM.

Modified Paths


Diff

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


--- trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java	2013-11-27 01:26:27 UTC (rev 2158)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java	2013-11-27 01:38:00 UTC (rev 2159)
@@ -15,10 +15,12 @@
 import com.thoughtworks.xstream.converters.reflection.ObjectAccessException;
 import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider;
 import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
+import com.thoughtworks.xstream.core.util.CustomObjectOutputStream;
 import com.thoughtworks.xstream.core.util.DependencyInjectionFactory;
 import com.thoughtworks.xstream.core.util.PresortedMap;
 import com.thoughtworks.xstream.core.util.PresortedSet;
 
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.security.AccessControlException;
@@ -42,6 +44,7 @@
     private static final boolean optimizedTreeSetAddAll;
     private static final boolean optimizedTreeMapPutAll;
     private static final boolean canParseUTCDateFormat;
+    private static final boolean canCreateDerivedObjectOutputStream;
 
     private static final String vendor = System.getProperty("java.vm.vendor");
     private static final float majorJavaVersion = getMajorJavaVersion();
@@ -102,6 +105,14 @@
             test = false;
         }
         canParseUTCDateFormat = test;
+        try {
+            test = new CustomObjectOutputStream(null) != null;
+        } catch (RuntimeException e) {
+            test = false;
+        } catch (IOException e) {
+            test = false;
+        }
+        canCreateDerivedObjectOutputStream = test;
         
         isAWTAvailable = loadClassForName("java.awt.Color", false) != null;
         isSwingAvailable = loadClassForName("javax.swing.LookAndFeel", false) != null;
@@ -188,7 +199,7 @@
     private static boolean isAndroid() {
         return vendor.indexOf("Android") != -1;
     }
-
+    
     /**
      * Load a XStream class for the given name.
      * 
@@ -416,6 +427,13 @@
     }
 
     /**
+     * @since upcoming
+     */
+    public static boolean canCreateDerivedObjectOutputStream() {
+        return canCreateDerivedObjectOutputStream;
+    }
+
+    /**
      * @deprecated As of 1.4.5 no functionality
      */
     public void flushCache() {
@@ -479,6 +497,7 @@
         System.out.println("Optimized TreeSet.addAll: " + hasOptimizedTreeSetAddAll());
         System.out.println("Optimized TreeMap.putAll: " + hasOptimizedTreeMapPutAll());
         System.out.println("Can parse UTC date format: " + canParseUTCDateFormat());
+        System.out.println("Can create derive ObjectOutputStream: " + canCreateDerivedObjectOutputStream());
         System.out.println("Reverse field order detected (only if JVM class itself has been compiled): " + reverse);
     }
 }

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


--- trunk/xstream-distribution/src/content/changes.html	2013-11-27 01:26:27 UTC (rev 2158)
+++ trunk/xstream-distribution/src/content/changes.html	2013-11-27 01:38:00 UTC (rev 2159)
@@ -52,6 +52,15 @@
     	implemented calling put for every element within the map.</li>
     </ul>
 
+    <h2>API changes</h2>
+
+    <ul>
+    	<li>Added static method canCreateDerivedObjectOutputStream to c.t.x.core.JVM.</li>
+    	<li>Deprecated unused member c.t.x.converter.javabean.BeanProvider.NO_PARAMS.</li>
+    	<li>Deprecated unused method c.t.x.converter.javabean.BeanProvider.getDefaultConstrutor(Class).</li>
+    </ul>
+
+
     <h1 id="1.4.5">1.4.5</h1>
 
     <p>Released 18. September 2013.</p>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to