From: Ingo Proetel Date: Sat, 20 Sep 2003 21:23:47 +0000 (+0000) Subject: UnicastRef.java: make constructor public and check if serverobject is compatible... X-Git-Tag: releases/gcc-3.4.0~3616 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21cf98f6e0308e8cbb6ef5e829e8452d2750d9bb;p=thirdparty%2Fgcc.git UnicastRef.java: make constructor public and check if serverobject is compatible in case client... 2003-08-11 Ingo Proetel * 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) From-SVN: r71611 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4d5c52ec368c..b0cc71f5b47d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-08-11 Ingo Proetel + + * 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 * 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 9ab020db6c3f..aaec7a3b470d 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{