8009305: Improve AWT data transfer
authordfuchs
Thu, 14 Mar 2013 18:41:42 +0100
changeset 16884 e745e337f767
parent 16883 8c290711866f
child 16885 d54b22d3b306
8009305: Improve AWT data transfer Reviewed-by: art, skoivu, smarks, ant
jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java
--- a/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java	Sun Mar 03 10:07:52 2013 +0000
+++ b/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java	Thu Mar 14 18:41:42 2013 +0100
@@ -102,11 +102,11 @@
     protected final boolean isLocal;
 }
 
-class ClassLoaderObjectOutputStream extends ObjectOutputStream {
+final class ClassLoaderObjectOutputStream extends ObjectOutputStream {
     private final Map<Set<String>, ClassLoader> map =
         new HashMap<Set<String>, ClassLoader>();
 
-    public ClassLoaderObjectOutputStream(OutputStream os) throws IOException {
+    ClassLoaderObjectOutputStream(OutputStream os) throws IOException {
         super(os);
     }
 
@@ -140,16 +140,16 @@
         map.put(s, classLoader);
     }
 
-    public Map<Set<String>, ClassLoader> getClassLoaderMap() {
+    Map<Set<String>, ClassLoader> getClassLoaderMap() {
         return new HashMap(map);
     }
 }
 
-class ClassLoaderObjectInputStream extends ObjectInputStream {
+final class ClassLoaderObjectInputStream extends ObjectInputStream {
     private final Map<Set<String>, ClassLoader> map;
 
-    public ClassLoaderObjectInputStream(InputStream is,
-                                        Map<Set<String>, ClassLoader> map)
+    ClassLoaderObjectInputStream(InputStream is,
+                                 Map<Set<String>, ClassLoader> map)
       throws IOException {
         super(is);
         if (map == null) {
@@ -166,8 +166,11 @@
         s.add(className);
 
         ClassLoader classLoader = map.get(s);
-
-        return Class.forName(className, false, classLoader);
+        if (classLoader != null) {
+            return Class.forName(className, false, classLoader);
+        } else {
+            return super.resolveClass(classDesc);
+        }
     }
 
     protected Class<?> resolveProxyClass(String[] interfaces)
@@ -179,6 +182,9 @@
         }
 
         ClassLoader classLoader = map.get(s);
+        if (classLoader == null) {
+            return super.resolveProxyClass(interfaces);
+        }
 
         // The code below is mostly copied from the superclass.
         ClassLoader nonPublicLoader = null;