--- old/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java 2017-12-12 16:26:08.278311863 -0800 +++ new/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java 2017-12-12 16:26:07.878296866 -0800 @@ -72,13 +72,14 @@ if (contents == null) { throw new java.lang.RuntimeException("No input for writing to file" + file); } - FileOutputStream fos = new FileOutputStream(file); - PrintStream ps = new PrintStream(fos); - for (String str : contents) { - ps.println(str); + try ( + FileOutputStream fos = new FileOutputStream(file); + PrintStream ps = new PrintStream(fos) + ) { + for (String str : contents) { + ps.println(str); + } } - ps.close(); - fos.close(); } /* version.jar entries and files: