diff options
| author | Tom Tromey <tromey@redhat.com> | 2005-05-13 20:20:56 +0000 |
|---|---|---|
| committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-05-13 20:20:56 +0000 |
| commit | 9c309ac9a4e9d7f134c9d1714a355a20baa5dbdb (patch) | |
| tree | d5eb1fe4fe005a7a6920cc5b76a76a68c276441b /libjava/gnu | |
| parent | c2dba4ab4059335b9efb8f3da7e1887c347ff210 (diff) | |
| download | gcc-9c309ac9a4e9d7f134c9d1714a355a20baa5dbdb.tar.gz gcc-9c309ac9a4e9d7f134c9d1714a355a20baa5dbdb.tar.bz2 gcc-9c309ac9a4e9d7f134c9d1714a355a20baa5dbdb.zip | |
SystemClassLoader.java (init): Handle empty element in path.
* gnu/gcj/runtime/SystemClassLoader.java (init): Handle empty
element in path.
From-SVN: r99676
Diffstat (limited to 'libjava/gnu')
| -rw-r--r-- | libjava/gnu/gcj/runtime/SystemClassLoader.java | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/libjava/gnu/gcj/runtime/SystemClassLoader.java b/libjava/gnu/gcj/runtime/SystemClassLoader.java index 163d3dd84d7..e68770cc558 100644 --- a/libjava/gnu/gcj/runtime/SystemClassLoader.java +++ b/libjava/gnu/gcj/runtime/SystemClassLoader.java @@ -27,16 +27,30 @@ public final class SystemClassLoader extends URLClassLoader // causing a crash. void init() { + String sep = File.pathSeparator; StringTokenizer st = new StringTokenizer (System.getProperty ("java.class.path", "."), - File.pathSeparator); + sep, true); + // Pretend we start with a ':', so if we see a ':' first we add + // '.'. + boolean last_was_sep = true; while (st.hasMoreElements ()) { String e = st.nextToken (); try { - if ("".equals(e)) - e = "."; + if (sep.equals(e)) + { + if (last_was_sep) + { + // We saw two separators in a row, so add ".". + addURL(new URL("file", "", -1, "./")); + last_was_sep = false; + } + else + last_was_sep = true; + continue; + } File path = new File(e); // Ignore invalid paths. @@ -53,5 +67,18 @@ public final class SystemClassLoader extends URLClassLoader throw new RuntimeException(x); } } + // If we saw a trailing ":", add "." to the path. + if (last_was_sep) + { + try + { + addURL(new URL("file", "", -1, "./")); + } + catch (java.net.MalformedURLException x) + { + // This should never happen. + throw new RuntimeException(x); + } + } } } |
