提交 59257d3a 编写于 作者: D dfuchs

8009305: Improve AWT data transfer

Reviewed-by: art, skoivu, smarks, ant
上级 5a3bbd9a
...@@ -102,11 +102,11 @@ public class TransferableProxy implements Transferable { ...@@ -102,11 +102,11 @@ public class TransferableProxy implements Transferable {
protected final boolean isLocal; protected final boolean isLocal;
} }
class ClassLoaderObjectOutputStream extends ObjectOutputStream { final class ClassLoaderObjectOutputStream extends ObjectOutputStream {
private final Map<Set<String>, ClassLoader> map = private final Map<Set<String>, ClassLoader> map =
new HashMap<Set<String>, ClassLoader>(); new HashMap<Set<String>, ClassLoader>();
public ClassLoaderObjectOutputStream(OutputStream os) throws IOException { ClassLoaderObjectOutputStream(OutputStream os) throws IOException {
super(os); super(os);
} }
...@@ -140,16 +140,16 @@ class ClassLoaderObjectOutputStream extends ObjectOutputStream { ...@@ -140,16 +140,16 @@ class ClassLoaderObjectOutputStream extends ObjectOutputStream {
map.put(s, classLoader); map.put(s, classLoader);
} }
public Map<Set<String>, ClassLoader> getClassLoaderMap() { Map<Set<String>, ClassLoader> getClassLoaderMap() {
return new HashMap(map); return new HashMap(map);
} }
} }
class ClassLoaderObjectInputStream extends ObjectInputStream { final class ClassLoaderObjectInputStream extends ObjectInputStream {
private final Map<Set<String>, ClassLoader> map; private final Map<Set<String>, ClassLoader> map;
public ClassLoaderObjectInputStream(InputStream is, ClassLoaderObjectInputStream(InputStream is,
Map<Set<String>, ClassLoader> map) Map<Set<String>, ClassLoader> map)
throws IOException { throws IOException {
super(is); super(is);
if (map == null) { if (map == null) {
...@@ -166,8 +166,11 @@ class ClassLoaderObjectInputStream extends ObjectInputStream { ...@@ -166,8 +166,11 @@ class ClassLoaderObjectInputStream extends ObjectInputStream {
s.add(className); s.add(className);
ClassLoader classLoader = map.get(s); ClassLoader classLoader = map.get(s);
if (classLoader != null) {
return Class.forName(className, false, classLoader); return Class.forName(className, false, classLoader);
} else {
return super.resolveClass(classDesc);
}
} }
protected Class<?> resolveProxyClass(String[] interfaces) protected Class<?> resolveProxyClass(String[] interfaces)
...@@ -179,6 +182,9 @@ class ClassLoaderObjectInputStream extends ObjectInputStream { ...@@ -179,6 +182,9 @@ class ClassLoaderObjectInputStream extends ObjectInputStream {
} }
ClassLoader classLoader = map.get(s); ClassLoader classLoader = map.get(s);
if (classLoader == null) {
return super.resolveProxyClass(interfaces);
}
// The code below is mostly copied from the superclass. // The code below is mostly copied from the superclass.
ClassLoader nonPublicLoader = null; ClassLoader nonPublicLoader = null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册