Index: gnu/java/nio/FileLockImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/FileLockImpl.java,v retrieving revision 1.3 diff -u -b -B -r1.3 FileLockImpl.java --- gnu/java/nio/FileLockImpl.java 20 Oct 2003 15:32:56 -0000 1.3 +++ gnu/java/nio/FileLockImpl.java 25 Jan 2004 13:24:58 -0000 @@ -1,5 +1,5 @@ -/* FileChannelImpl.java -- - Copyright (C) 2002 Free Software Foundation, Inc. +/* FileLockImpl.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -60,20 +60,29 @@ } private FileDescriptor fd; - private boolean released; public FileLockImpl (FileDescriptor fd, FileChannel channel, long position, long size, boolean shared) { super (channel, position, size, shared); this.fd = fd; - this.released = false; + } + + public void finalize() + { + try + { + release(); + } + catch (IOException e) + { + // Ignore this. + } } public boolean isValid () { - return (released - || !channel ().isOpen ()); + return !channel().isOpen(); } private native void releaseImpl () throws IOException; @@ -81,6 +90,5 @@ public synchronized void release () throws IOException { releaseImpl (); - released = true; } }