This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.rmi.Naming
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 27 Dec 2003 00:29:12 +0100
- Subject: FYI: Patch: java.rmi.Naming
Hi list,
I commited the attached patch to merge java.rmi.Naming with classpath again.
Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2491
diff -u -b -B -r1.2491 ChangeLog
--- ChangeLog 26 Dec 2003 22:10:19 -0000 1.2491
+++ ChangeLog 26 Dec 2003 23:22:48 -0000
@@ -1,3 +1,11 @@
+2003-12-27 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/rmi/Naming.java (lookup): Check if the first character of the
+ filename returned by URL.getFile() is a '/', only if it is the case
+ we cut this first character and call the registry with the good name.
+ (bind): Likewise.
+ (rebind): Likewise.
+
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
Mark Wielaard <mark@klomp.org>
Index: java/rmi/Naming.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/rmi/Naming.java,v
retrieving revision 1.3
diff -u -b -B -r1.3 Naming.java
--- java/rmi/Naming.java 25 Sep 2003 14:38:02 -0000 1.3
+++ java/rmi/Naming.java 26 Dec 2003 23:22:48 -0000
@@ -62,7 +62,14 @@
// hack to accept "rmi://host:port/service" strings
if(name.startsWith("rmi:")){ name = name.substring(4); }
URL u = new URL("http:" + name);
- return (getRegistry(u).lookup(u.getFile().substring(1)));
+ String filename = u.getFile();
+
+ // If the filename begins with a slash we must cut it for
+ // name resolution.
+ if (filename.charAt(0) == '/')
+ return (getRegistry(u).lookup(filename.substring(1)));
+ else
+ return (getRegistry(u).lookup(filename));
}
/**
@@ -75,7 +82,13 @@
*/
public static void bind(String name, Remote obj) throws AlreadyBoundException, MalformedURLException, RemoteException {
URL u = new URL("http:" + name);
- getRegistry(u).bind(u.getFile().substring(1), obj);
+ String filename = u.getFile();
+ // If the filename begins with a slash we must cut it for
+ // name resolution.
+ if (filename.charAt(0) == '/')
+ getRegistry(u).bind(filename.substring(1), obj);
+ else
+ getRegistry(u).bind(filename, obj);
}
/**
@@ -87,7 +100,13 @@
*/
public static void unbind(String name) throws RemoteException, NotBoundException, MalformedURLException {
URL u = new URL("http:" + name);
- getRegistry(u).unbind(u.getFile().substring(1));
+ String filename = u.getFile();
+ // If the filename begins with a slash we must cut it for
+ // name resolution.
+ if (filename.charAt(0) == '/')
+ getRegistry(u).unbind(filename.substring(1));
+ else
+ getRegistry(u).unbind(filename);
}
/**
@@ -100,7 +119,13 @@
*/
public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException {
URL u = new URL("http:" + name);
- getRegistry(u).rebind(u.getFile().substring(1), obj);
+ String filename = u.getFile();
+ // If the filename begins with a slash we must cut it for
+ // name resolution.
+ if (filename.charAt(0) == '/')
+ getRegistry(u).rebind(filename.substring(1), obj);
+ else
+ getRegistry(u).rebind(filename, obj);
}
/**