--- a/test/sun/nio/ch/TempBuffer.java 2011-05-19 18:13:54.000000000 +0200 +++ b/test/sun/nio/ch/TempBuffer.java 2011-05-27 14:23:20.000000000 +0200 @@ -48,9 +48,10 @@ Thread writerThread = new Thread() { public void run() { + File blah = null; try { OutputStream out = Channels.newOutputStream(sinkChannel); - File blah = File.createTempFile("blah1", null); + blah = File.createTempFile("blah1", null); blah.deleteOnExit(); TempBuffer.initTestFile(blah); RandomAccessFile raf = new RandomAccessFile(blah, "rw"); @@ -59,11 +60,17 @@ fc.transferTo(0, SIZE, Channels.newChannel(out)); } finally { fc.close(); + raf.close(); } out.flush(); } catch (IOException ioe) { throw new RuntimeException(ioe); } + finally { + if (blah != null) { + blah.delete(); + } + } } }; @@ -100,5 +107,6 @@ } awriter.flush(); awriter.close(); + fos.close(); } }