--- old/test/java/util/Formatter/FailingConstructors.java 2011-02-21 17:40:20.968882737 -0800 +++ new/test/java/util/Formatter/FailingConstructors.java 2011-02-21 17:40:20.672431857 -0800 @@ -47,9 +47,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();