1 |
/* |
/* |
2 |
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
50 |
public class RMIObjectInputStream |
public class RMIObjectInputStream |
51 |
extends ObjectInputStream { |
extends ObjectInputStream { |
52 |
|
|
53 |
UnicastConnectionManager manager; |
public RMIObjectInputStream(InputStream strm) throws IOException { |
|
|
|
|
public RMIObjectInputStream(InputStream strm, UnicastConnectionManager man) throws IOException { |
|
54 |
super(strm); |
super(strm); |
|
manager = man; |
|
55 |
enableResolveObject(true); |
enableResolveObject(true); |
56 |
} |
} |
57 |
|
|
|
public RMIObjectInputStream(InputStream strm) throws IOException { |
|
|
this(strm, UnicastConnectionManager.getInstance(0, null)); |
|
|
} |
|
|
|
|
58 |
protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { |
protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { |
59 |
String annotation = (String)getAnnotation(); |
String annotation = (String)getAnnotation(); |
|
try{ |
|
|
return super.resolveClass(desc); |
|
|
}catch(ClassNotFoundException _){}; |
|
60 |
|
|
61 |
try { |
try { |
62 |
if(annotation == null) |
if(annotation == null) |
80 |
throws IOException, ClassNotFoundException |
throws IOException, ClassNotFoundException |
81 |
{ |
{ |
82 |
String annotation = (String)getAnnotation(); |
String annotation = (String)getAnnotation(); |
|
try{ |
|
|
return super.resolveProxyClass(intfs); |
|
|
}catch(ClassNotFoundException _){}; |
|
83 |
|
|
84 |
Class clss[] = new Class[intfs.length]; |
Class clss[] = new Class[intfs.length]; |
85 |
if(annotation == null) |
if(annotation == null) |
86 |
clss[0] = RMIClassLoader.loadClass(intfs[0]); |
clss[0] = RMIClassLoader.loadClass(intfs[0]); |
87 |
else |
else |
88 |
clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]); |
clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]); |
89 |
|
|
90 |
//assume all interfaces can be loaded by the same classloader |
//assume all interfaces can be loaded by the same classloader |
91 |
ClassLoader loader = clss[0].getClassLoader(); |
ClassLoader loader = clss[0].getClassLoader(); |
92 |
if(loader == null) |
for (int i = 0; i < intfs.length; i++) |
93 |
for(int i = 1; i < intfs.length; i++) |
clss[i] = Class.forName(intfs[i], false, loader); |
94 |
clss[i] = Class.forName(intfs[i]); |
|
95 |
else |
try { |
|
for(int i = 1; i < intfs.length; i++) |
|
|
clss[i] = loader.loadClass(intfs[i]); |
|
96 |
return Proxy.getProxyClass(loader, clss); |
return Proxy.getProxyClass(loader, clss); |
97 |
|
} catch (IllegalArgumentException e) { |
98 |
|
throw new ClassNotFoundException(null, e); |
99 |
|
} |
100 |
} |
} |
101 |
|
|
102 |
protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException { |
protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException { |
123 |
return readObject(); |
return readObject(); |
124 |
} |
} |
125 |
|
|
|
} |
|
126 |
|
} |