[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: class loading fixes
Kaffe CVS
cvs-commits at kaffe.org
Tue Feb 15 19:36:38 PST 2005
PatchSet 5550
Date: 2005/02/16 03:30:19
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: class loading fixes
2005-02-16 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-02-14 Mark Wielaard <mark at klomp.org>
* java/net/URLClassLoader.java (findClass): Throw
ClassNotFoundExceptions including urls, plus parent using toString().
(thisString): New field.
(toString): New method.
* java/lang/ClassLoader (defaultGetSystemClassLoader): Only install
ExtensionClassLoader when there are actual extension URLs.
Members:
ChangeLog:1.3594->1.3595
libraries/javalib/java/lang/ClassLoader.java:1.37->1.38
libraries/javalib/java/net/URLClassLoader.java:1.21->1.22
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3594 kaffe/ChangeLog:1.3595
--- kaffe/ChangeLog:1.3594 Wed Feb 16 03:24:15 2005
+++ kaffe/ChangeLog Wed Feb 16 03:30:19 2005
@@ -2,6 +2,20 @@
Resynced with GNU Classpath.
+ 2005-02-14 Mark Wielaard <mark at klomp.org>
+
+ * java/net/URLClassLoader.java (findClass): Throw
+ ClassNotFoundExceptions including urls, plus parent using toString().
+ (thisString): New field.
+ (toString): New method.
+
+ * java/lang/ClassLoader (defaultGetSystemClassLoader): Only install
+ ExtensionClassLoader when there are actual extension URLs.
+
+2005-02-16 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-02-14 Tom Tromey <tromey at redhat.com>
* java/net/URLClassLoader.java (URLLoader(URLClassLoader, URL,
Index: kaffe/libraries/javalib/java/lang/ClassLoader.java
diff -u kaffe/libraries/javalib/java/lang/ClassLoader.java:1.37 kaffe/libraries/javalib/java/lang/ClassLoader.java:1.38
--- kaffe/libraries/javalib/java/lang/ClassLoader.java:1.37 Tue Jan 18 14:08:19 2005
+++ kaffe/libraries/javalib/java/lang/ClassLoader.java Wed Feb 16 03:30:23 2005
@@ -1053,8 +1053,13 @@
static ClassLoader defaultGetSystemClassLoader()
{
- ClassLoader extClassLoader =
- new URLClassLoader(getExtClassLoaderUrls(), null);
+ URL[] extURLs = getExtClassLoaderUrls();
+ ClassLoader extClassLoader;
+ if (extURLs.length > 0)
+ extClassLoader = new URLClassLoader(getExtClassLoaderUrls(), null);
+ else
+ extClassLoader = null;
+
ClassLoader systemClassLoader =
new URLClassLoader(getSystemClassLoaderUrls(), extClassLoader)
{
Index: kaffe/libraries/javalib/java/net/URLClassLoader.java
diff -u kaffe/libraries/javalib/java/net/URLClassLoader.java:1.21 kaffe/libraries/javalib/java/net/URLClassLoader.java:1.22
--- kaffe/libraries/javalib/java/net/URLClassLoader.java:1.21 Wed Feb 16 03:24:17 2005
+++ kaffe/libraries/javalib/java/net/URLClassLoader.java Wed Feb 16 03:30:24 2005
@@ -1,5 +1,6 @@
/* URLClassLoader.java -- ClassLoader that loads classes from one or more URLs
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -750,7 +751,7 @@
String resourceName = className.replace('.', '/') + ".class";
Resource resource = findURLResource(resourceName);
if (resource == null)
- throw new ClassNotFoundException(className + " not found in " + urls);
+ throw new ClassNotFoundException(className + " not found in " + this);
// Try to read the class data, create the CodeSource, Package and
// construct the class (and watch out for those nasty IOExceptions)
@@ -842,8 +843,42 @@
}
catch (IOException ioe)
{
- throw new ClassNotFoundException(className, ioe);
+ ClassNotFoundException cnfe;
+ cnfe = new ClassNotFoundException(className + " not found in " + this);
+ cnfe.initCause(ioe);
+ throw cnfe;
}
+ }
+
+ // Cached String representation of this URLClassLoader
+ private String thisString;
+
+ /**
+ * Returns a String representation of this URLClassLoader giving the
+ * actual Class name, the URLs that are searched and the parent
+ * ClassLoader.
+ */
+ public String toString()
+ {
+ if (thisString == null)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(this.getClass().getName());
+ sb.append("{urls=[" );
+ URL[] thisURLs = getURLs();
+ for (int i = 0; i < thisURLs.length; i++)
+ {
+ sb.append(thisURLs[i]);
+ if (i < thisURLs.length - 1)
+ sb.append(',');
+ }
+ sb.append(']');
+ sb.append(", parent=");
+ sb.append(getParent());
+ sb.append('}');
+ thisString = sb.toString();
+ }
+ return thisString;
}
/**
More information about the kaffe
mailing list