test/java/util/Formatter/FailingConstructors.java

Print this page
rev 3509 : 7021209: convert lang, math, util to use try-with-resources
Reviewed-by: XXX

*** 45,57 **** test(false, new File(fileName)); /* 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(); test(true, file); file.delete(); } --- 45,57 ---- test(false, new File(fileName)); /* create the file and write its contents */ File file = File.createTempFile(fileName, null); file.deleteOnExit(); ! try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(FILE_CONTENTS.getBytes()); ! } test(true, file); file.delete(); }