bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/25866] New: rmi - UnicastRemoteObject.exportObject() brok


From: tmikov at gmail dot com
Subject: [Bug classpath/25866] New: rmi - UnicastRemoteObject.exportObject() broken
Date: 20 Jan 2006 03:32:08 -0000

UnicastRemoteObject.exportObject() casts its parameter to a
java.rmi.server.RemoteObject. This always throws ClassCastException - 
UnicastRemoteObject.exportObject() is supposed to export objects without
restrictions for their base class.

Here is the relevant code from 
http://gcc.gnu.org/viewcvs/trunk/libjava/classpath/java/rmi/server/UnicastRemoteObject.java?view=markup

public static RemoteStub exportObject(Remote obj) throws RemoteException {
   82   UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef();
   83   return (sref.exportObject(obj));
   84 }

The method appears to be written with the intent of being invoked with
instances of UnicastRemoteObject, which is not how it should work.

This probably will not be a trivial fix - exportObject() is supposed to load
the stub, or construct a proxy object. See
http://java.sun.com/j2se/1.5.0/docs/api/java/rmi/server/UnicastRemoteObject.html

The workaround is not to use exportObject(), but to subclass
UnicastRemoteObject, however in many cases this is not possible. So for some
applications (e.g. mine :-) it breaks RMI completely.


-- 
           Summary: rmi - UnicastRemoteObject.exportObject() broken
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tmikov at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25866





reply via email to

[Prev in Thread] Current Thread [Next in Thread]