URLClassLoader update

Mark Wielaard mark@klomp.org
Mon Nov 25 15:39:00 GMT 2002


Hi,

The last couple of weeks I have rewritten the URLClassLoader
implementation based on the old GNU Classpath version and the changes
that the Orp developers made. This version has different Loaders for the
different types of URLs that can be given to the URLClassLoader
(URLClassLoader now works for remote locations! - now if only we had a
complete verifier and security permissions framework...).
It tries to do something sensible with the security context of the
caller of newInstance and always creates the correct Package and
CodeSource for a newly loaded class.

There are also some updates to (VM)ClassLoader but I didn't completely
merge these classes with the GNU Classpath versions. A good
implementation should actually split the system classloader, that loads
the native code, and the application classloader, that loads interpreted
byte code, and should use the ClassLoader parent delegation model. But
that change seemed to big when we are this close to a code freeze.

The JarURLConnection and the jar handler code have also not yet been
merged with the GNU Classpath version. This is still a good idea (since
I have now fixed bugs in both), but I just didn't have enough time.

This patch depends on the just submitted "lazy jar/zip file patch".

2002-11-25  Mark Wielaard  <mark@klomp.org>

        * gnu/gcj/protocol/jar/Connection.java (getJarFile): download and
        cache remote jar files.
        * gnu/gcj/runtime/VMClassLoader.java: Don't construct jar URL, only
        add File.separator to URL when it is a directory.
        * java/lang/ClassLoader.java: Add Classpath javadoc.
        (parent): final.
        (getParent): Add (disabled) security check.
        (findLibrary): New default method.
        (normalize): New private method.
        (getResource): Use normalize.
        (getResources): Likewsie.
        * java/net/JarURLConnection.java (getManifest): Implement.
        (getInputStream): Only create InputStream when entry exists.
        (getHeaders): Only use jarFileURLConnection or JarEntry to set length   
        when they exist.
        * java/net/URLClassLoader.java: New version from Classpath.

With this patch all new relevant Mauve URLClassLoader tests pass.

There seems to be one regression though in the libjava.loader testsuite.
FAIL: TestEarlyGC.exe output
Which prints nine times "finalized" on my system and according to the
TestEarlyGC.out should not print anything. The problem is that the
actualy code is obfuscated (there is a big byte array inside the source
that represents the byte code of a class). Is the actual java source
somewhere? That would make debugging a bit easier.

I currently don't have an old build around to check against (disk space
is low at the moment), but on my other (powerpc) this test does not
fail. I did notice that this test seems to fail for some people e.g.
http://gcc.gnu.org/ml/gcc-testresults/2002-11/msg00925.html
http://gcc.gnu.org/ml/gcc-testresults/2002-11/msg00857.html

So if this isn't actually a regression, would it be OK to check this in?

Cheers,

Mark

-------------- next part --------------
A non-text attachment was scrubbed...
Name: URLClassLoader.patch
Type: text/x-patch
Size: 56930 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20021125/0f1f4b58/attachment.bin>


More information about the Java-patches mailing list