aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/rmi
diff options
context:
space:
mode:
authorGuilhem Lavaux <guilhem@kaffe.org>2003-12-26 23:23:55 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-12-26 23:23:55 +0000
commita4dc20a94636a27c0250b3cadbc23758901d8fb7 (patch)
treed0b5cd9683876b542d93dcfe5e9d3652ca5166b4 /libjava/java/rmi
parent45d51d7e37ac54da97e497a0946f675be40fe230 (diff)
downloadgcc-a4dc20a94636a27c0250b3cadbc23758901d8fb7.zip
gcc-a4dc20a94636a27c0250b3cadbc23758901d8fb7.tar.gz
gcc-a4dc20a94636a27c0250b3cadbc23758901d8fb7.tar.bz2
Naming.java (lookup): Check if the first character of the filename returned by URL.getFile() is a '/'...
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. From-SVN: r75044
Diffstat (limited to 'libjava/java/rmi')
-rw-r--r--libjava/java/rmi/Naming.java33
1 files changed, 29 insertions, 4 deletions
diff --git a/libjava/java/rmi/Naming.java b/libjava/java/rmi/Naming.java
index 2dd50d3..1d2e68b 100644
--- a/libjava/java/rmi/Naming.java
+++ b/libjava/java/rmi/Naming.java
@@ -62,7 +62,14 @@ public static Remote lookup(String name) throws NotBoundException, MalformedURLE
// 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 Remote lookup(String name) throws NotBoundException, MalformedURLE
*/
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 bind(String name, Remote obj) throws AlreadyBoundException, M
*/
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 unbind(String name) throws RemoteException, NotBoundException
*/
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);
}
/**