Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.2734 diff -u -r1.2734 ChangeLog --- ChangeLog 5 Nov 2004 22:38:47 -0000 1.2734 +++ ChangeLog 5 Nov 2004 22:45:14 -0000 @@ -1,5 +1,11 @@ 2004-11-05 Noa Resare + * gnu/java/nio/channels/FileChannelImpl.java(FileChannelImpl), + java/io/File.java(createNewFile): If native operation fails, + finalize and try again. + +2004-11-05 Noa Resare + * java/net/Socket.java(getPort): Return 0 instead of -1 on unconnected sockets. Index: gnu/java/nio/channels/FileChannelImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/channels/FileChannelImpl.java,v retrieving revision 1.7 diff -u -r1.7 FileChannelImpl.java --- gnu/java/nio/channels/FileChannelImpl.java 2 May 2004 09:13:33 -0000 1.7 +++ gnu/java/nio/channels/FileChannelImpl.java 5 Nov 2004 22:45:14 -0000 @@ -103,7 +103,17 @@ /* Open a file. MODE is a combination of the above mode flags. */ public FileChannelImpl (String path, int mode) throws FileNotFoundException { - fd = open (path, mode); + try + { + fd = open (path, mode); + } + catch (FileNotFoundException e) + { + // This could be 'too many open files'. Finalize and try again. + System.gc(); + System.runFinalization(); + fd = open (path, mode); + } this.mode = mode; } Index: java/io/File.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/io/File.java,v retrieving revision 1.51 diff -u -r1.51 File.java --- java/io/File.java 20 Oct 2004 08:08:52 -0000 1.51 +++ java/io/File.java 5 Nov 2004 22:45:14 -0000 @@ -185,7 +185,18 @@ public boolean createNewFile() throws IOException { checkWrite(); - return VMFile.create(path); + try + { + return VMFile.create(path); + } + catch (IOException e) + { + // This could be 'too many open files'. Finalize and try again. + System.gc(); + System.runFinalization(); + return VMFile.create(path); + } + } /** * This method deletes the file represented by this object. If this file