diff options
author | neroden <neroden@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-20 21:23:47 +0000 |
---|---|---|
committer | neroden <neroden@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-20 21:23:47 +0000 |
commit | 5f8cbb247ec85219df52dc33c57b2feb0f1e641f (patch) | |
tree | 85aea3e1ebf8e7fffd044f8091ea790b5c604ccd | |
parent | f9bdf3d8c136ddff135c4fe1271ba738995c931a (diff) | |
download | gcc-5f8cbb247ec85219df52dc33c57b2feb0f1e641f.tar.gz |
2003-08-11 Ingo Proetel <proetel@aicas.com>
* gnu/java/rmi/server/UnicastRef.java: make constructor public and check if serverobject
is compatible in case client and server are running in the same VM
(remerged from Classpath on 2003-09-20)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71611 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/gnu/java/rmi/server/UnicastRef.java | 44 |
2 files changed, 26 insertions, 24 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4d5c52ec368..b0cc71f5b47 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-08-11 Ingo Proetel <proetel@aicas.com> + + * gnu/java/rmi/server/UnicastRef.java: make constructor public and check if serverobject + is compatible in case client and server are running in the same VM + (remerged from Classpath on 2003-09-20) + 2003-09-19 David Daney <ddaney@avtrex.com> * java/lang/ref/Reference.java (clear): Set referent to null and diff --git a/libjava/gnu/java/rmi/server/UnicastRef.java b/libjava/gnu/java/rmi/server/UnicastRef.java index 9ab020db6c3..aaec7a3b470 100644 --- a/libjava/gnu/java/rmi/server/UnicastRef.java +++ b/libjava/gnu/java/rmi/server/UnicastRef.java @@ -37,32 +37,24 @@ exception statement from your version. */ package gnu.java.rmi.server; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectInputStream; +import java.io.ObjectOutput; +import java.io.ObjectOutputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.rmi.Remote; import java.rmi.RemoteException; -import java.rmi.server.RemoteRef; -import java.rmi.server.RMISocketFactory; +import java.rmi.server.ObjID; +import java.rmi.server.Operation; import java.rmi.server.RMIClientSocketFactory; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.RemoteObject; import java.rmi.server.RemoteCall; -import java.rmi.server.UnicastRemoteObject; -import java.rmi.server.Operation; -import java.rmi.server.ObjID; +import java.rmi.server.RemoteObject; +import java.rmi.server.RemoteRef; import java.rmi.server.UID; -import java.lang.reflect.Method; -import java.io.ObjectOutput; -import java.io.ObjectInput; -import java.io.IOException; -import java.net.Socket; -import java.net.InetAddress; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; - -import java.lang.reflect.InvocationTargetException; public class UnicastRef implements RemoteRef, ProtocolConstants { @@ -73,8 +65,9 @@ UnicastConnectionManager manager; /** * Used by serialization, and let subclass capable of having default constructor */ -//private -UnicastRef() { +// must be public otherwise java.rmi.RemoteObject cannot instantiate this class +// -- iP +public UnicastRef() { } public UnicastRef(ObjID objid, String host, int port, RMIClientSocketFactory csf) { @@ -90,7 +83,10 @@ public Object invoke(Remote obj, Method method, Object[] params, long opnum) thr // Check if client and server are in the same VM, then local call can be used to // replace remote call, but it's somewhat violating remote semantic. Object svrobj = manager.serverobj; - if(svrobj != null){ + + // Make sure that the server object is compatible. It could be loaded from a different + // classloader --iP + if(svrobj != null && method.getDeclaringClass().isInstance(svrobj)){ //local call Object ret = null; try{ |