VMClassLoader.java (init): Check classpath entry before passing to URL constructor.
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. From-SVN: r84138
This commit is contained in:
parent
a86f03720b
commit
a1433c46a1
2 changed files with 26 additions and 19 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
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>
|
2004-07-05 Bryce McKinlay <mckinlay@redhat.com>
|
||||||
|
|
||||||
* java/util/Locale.java (readObject): Intern strings read from object
|
* java/util/Locale.java (readObject): Intern strings read from object
|
||||||
|
|
|
@ -47,58 +47,58 @@ public final class VMClassLoader extends java.net.URLClassLoader
|
||||||
String e = st.nextToken ();
|
String e = st.nextToken ();
|
||||||
try
|
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));
|
addURL(new URL("file", "", -1, e + File.separator));
|
||||||
else
|
else
|
||||||
addURL(new URL("file", "", -1, e));
|
addURL(new URL("file", "", -1, e));
|
||||||
}
|
}
|
||||||
catch (java.net.MalformedURLException x)
|
catch (java.net.MalformedURLException x)
|
||||||
{
|
{
|
||||||
/* Ignore this path element */
|
// This should never happen.
|
||||||
|
throw new RuntimeException(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the contents of the extensions directories.
|
// Add the contents of the extensions directories.
|
||||||
st = new StringTokenizer (System.getProperty ("java.ext.dirs"),
|
st = new StringTokenizer (System.getProperty ("java.ext.dirs"),
|
||||||
System.getProperty ("path.separator", ":"));
|
System.getProperty ("path.separator", ":"));
|
||||||
while (st.hasMoreElements ())
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
String dirname = st.nextToken ();
|
while (st.hasMoreElements ())
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
String dirname = st.nextToken ();
|
||||||
File dir = new File (dirname);
|
File dir = new File (dirname);
|
||||||
if (dir.exists ())
|
if (dir.exists ())
|
||||||
{
|
{
|
||||||
if (! dirname.endsWith (File.separator))
|
if (! dirname.endsWith (File.separator))
|
||||||
dirname = dirname + File.separator;
|
dirname = dirname + File.separator;
|
||||||
String files[]
|
String files[]
|
||||||
= dir.list (new FilenameFilter ()
|
= dir.list (new FilenameFilter ()
|
||||||
{
|
{
|
||||||
public boolean accept (File dir, String name)
|
public boolean accept (File dir, String name)
|
||||||
{
|
{
|
||||||
return (name.endsWith (".jar")
|
return (name.endsWith (".jar")
|
||||||
|| name.endsWith (".zip"));
|
|| name.endsWith (".zip"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (int i = files.length - 1; i >= 0; i--)
|
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
|
// Add core:/ to the end of the java.class.path so any resources
|
||||||
// compiled into this executable may be found.
|
// compiled into this executable may be found.
|
||||||
try
|
|
||||||
{
|
|
||||||
addURL(new URL("core", "", -1, "/"));
|
addURL(new URL("core", "", -1, "/"));
|
||||||
}
|
}
|
||||||
catch (java.net.MalformedURLException x)
|
catch (java.net.MalformedURLException x)
|
||||||
{
|
{
|
||||||
// This should never happen.
|
// This should never happen.
|
||||||
|
throw new RuntimeException(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue