Title: [2212] trunk/xstream/src/java/com/thoughtworks/xstream: Fix access to java.beans.EventHandler, that does not exist in Android.
Revision
2212
Author
joehni
Date
2014-01-14 13:01:23 -0600 (Tue, 14 Jan 2014)

Log Message

Fix access to java.beans.EventHandler, that does not exist in Android.

Modified Paths

Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/ReflectionConverter.java (2211 => 2212)


--- trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/ReflectionConverter.java	2014-01-11 14:45:43 UTC (rev 2211)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/ReflectionConverter.java	2014-01-14 19:01:23 UTC (rev 2212)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Joe Walnes.
- * Copyright (C) 2006, 2007, 2013 XStream Committers.
+ * Copyright (C) 2006, 2007, 2013, 2014 XStream Committers.
  * All rights reserved.
  *
  * The software in this package is published under the terms of the BSD
@@ -11,12 +11,13 @@
  */
 package com.thoughtworks.xstream.converters.reflection;
 
-import java.beans.EventHandler;
-
+import com.thoughtworks.xstream.core.JVM;
 import com.thoughtworks.xstream.mapper.Mapper;
 
 public class ReflectionConverter extends AbstractReflectionConverter {
 
+    // Might be missing in Android
+    private final static Class eventHandlerType = JVM.loadClassForName("java.beans.EventHandler");
     private Class type;
 
     public ReflectionConverter(Mapper mapper, ReflectionProvider reflectionProvider) {
@@ -37,7 +38,7 @@
     }
 
     public boolean canConvert(Class type) {
-        return ((this.type != null && this.type == type) || (this.type == null && type != null && type != EventHandler.class))
+        return ((this.type != null && this.type == type) || (this.type == null && type != null && type != eventHandlerType))
             && canAccess(type);
     }
 }

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


--- trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java	2014-01-11 14:45:43 UTC (rev 2211)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/core/JVM.java	2014-01-14 19:01:23 UTC (rev 2212)
@@ -23,7 +23,6 @@
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.security.AccessControlException;
 import java.text.AttributedString;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -504,6 +503,7 @@
         System.out.println("Supports AWT: " + isAWTAvailable());
         System.out.println("Supports Swing: " + isSwingAvailable());
         System.out.println("Supports SQL: " + isSQLAvailable());
+        System.out.println("Java Beans EventHandler present: " + (loadClassForName("java.beans.EventHandler") != null));
         System.out.println("Standard StAX XMLInputFactory: " + staxInputFactory);
         System.out.println("Standard StAX XMLOutputFactory: " + staxOutputFactory);
         System.out.println("Optimized TreeSet.addAll: " + hasOptimizedTreeSetAddAll());

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to