--- old/test/java/util/Scanner/FailingConstructors.java 2011-02-21 17:40:24.248729567 -0800 +++ new/test/java/util/Scanner/FailingConstructors.java 2011-02-21 17:40:23.940701497 -0800 @@ -46,9 +46,9 @@ /* create the file and write its contents */ File file = File.createTempFile(fileName, null); file.deleteOnExit(); - FileOutputStream fos = new FileOutputStream(file); - fos.write(FILE_CONTENTS.getBytes()); - fos.close(); + try (FileOutputStream fos = new FileOutputStream(file)) { + fos.write(FILE_CONTENTS.getBytes()); + } test(true, file); file.delete();