diff options
| author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-05 23:18:14 +0000 |
|---|---|---|
| committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-05 23:18:14 +0000 |
| commit | 4de8a81309f04b4f69e5870b099ef24876d47e93 (patch) | |
| tree | 1635a074c2ad50cd8bfb54b911d602de0d8e2c89 /libjava | |
| parent | 927b9dc44e53e29bed67e70b90579a7b43d4a915 (diff) | |
| download | ppe42-gcc-4de8a81309f04b4f69e5870b099ef24876d47e93.tar.gz ppe42-gcc-4de8a81309f04b4f69e5870b099ef24876d47e93.zip | |
2004-07-05 Bryce McKinlay <mckinlay@redhat.com>
* gnu/gcj/runtime/VMClassLoader.java (init): Check classpath entry
before passing to URL constructor. Rethrow any MalformedURLException
as a RuntimeException. Catch MalformedURLException specifically, not
all exceptions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84138 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
| -rw-r--r-- | libjava/ChangeLog | 7 | ||||
| -rw-r--r-- | libjava/gnu/gcj/runtime/VMClassLoader.java | 38 |
2 files changed, 26 insertions, 19 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1a3822d1d51..4cff650aac7 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,12 @@ 2004-07-05 Bryce McKinlay <mckinlay@redhat.com> + * gnu/gcj/runtime/VMClassLoader.java (init): Check classpath entry + before passing to URL constructor. Rethrow any MalformedURLException + as a RuntimeException. Catch MalformedURLException specifically, not + all exceptions. + +2004-07-05 Bryce McKinlay <mckinlay@redhat.com> + * java/util/Locale.java (readObject): Intern strings read from object stream. diff --git a/libjava/gnu/gcj/runtime/VMClassLoader.java b/libjava/gnu/gcj/runtime/VMClassLoader.java index 5e7f4c8ea90..1fc7081bb78 100644 --- a/libjava/gnu/gcj/runtime/VMClassLoader.java +++ b/libjava/gnu/gcj/runtime/VMClassLoader.java @@ -47,58 +47,58 @@ public final class VMClassLoader extends java.net.URLClassLoader String e = st.nextToken (); try { - if (!e.endsWith (File.separator) && new File (e).isDirectory ()) + File path = new File(e); + // Ignore invalid paths. + if (!path.exists()) + continue; + if (!e.endsWith (File.separator) && path.isDirectory ()) addURL(new URL("file", "", -1, e + File.separator)); else addURL(new URL("file", "", -1, e)); } catch (java.net.MalformedURLException x) { - /* Ignore this path element */ + // This should never happen. + throw new RuntimeException(x); } } // Add the contents of the extensions directories. st = new StringTokenizer (System.getProperty ("java.ext.dirs"), System.getProperty ("path.separator", ":")); - while (st.hasMoreElements ()) + + try { - String dirname = st.nextToken (); - try + while (st.hasMoreElements ()) { + String dirname = st.nextToken (); File dir = new File (dirname); if (dir.exists ()) { if (! dirname.endsWith (File.separator)) - dirname = dirname + File.separator; + dirname = dirname + File.separator; String files[] - = dir.list (new FilenameFilter () + = dir.list (new FilenameFilter () { public boolean accept (File dir, String name) { - return (name.endsWith (".jar") - || name.endsWith (".zip")); + return (name.endsWith (".jar") + || name.endsWith (".zip")); } }); for (int i = files.length - 1; i >= 0; i--) - addURL(new URL("file", "", -1, dirname + files[i])); + addURL(new URL("file", "", -1, dirname + files[i])); } } - catch (Exception x) - { - // Just ignore any badness. - } - } - // Add core:/ to the end of the java.class.path so any resources - // compiled into this executable may be found. - try - { + // Add core:/ to the end of the java.class.path so any resources + // compiled into this executable may be found. addURL(new URL("core", "", -1, "/")); } catch (java.net.MalformedURLException x) { // This should never happen. + throw new RuntimeException(x); } } |

