classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small ZipFile patch


From: Jeroen Frijters
Subject: Small ZipFile patch
Date: Tue, 4 Mar 2003 15:11:44 +0100

Hi,

ZipFile has a finalizer (it shouldn't!) and that tries to close the RandomAccessFile, even the RandomAccessFile never was created, this causes an NPE during finalization, not a big deal, but since .NET 1.1 decided to print these to the console, it's kind of distracting.

ZipFile really shouldn't have a finalizer though (if you have a pure Java implementation). Only classes that own native resources should have finalizers.

BTW, the design of the 1.0 I/O classes is less than stellar. Since the FileDescriptor class is the owner of the native resource, it should have had a finalizer, instead of FileInputStream and FileOutputStream (for some reason RandomAccessFile doesn't have a finalizer). I guess I should be a bit mild in my criticism, finalizers weren't very well understood back then...

BTW 2, in gnu\java\nio\ServerSocketChannelImpl.java and gnu\java\nio\SocketChannelImpl.java both have method called finalize*r* and that probably should be finalize (although since these classes do not seem to own any native resources, they really don't need a finalizer).

Regards,
Jeroen

Attachment: zipfile.patch
Description: zipfile.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]