8302685: Some javac unit tests aren't reliably closing open files

Reviewed-by: darcy, vromero
This commit is contained in:
Archie L. Cobbs 2023-02-27 16:21:57 +00:00 committed by Vicente Romero
parent f5a12768fb
commit 55e6bb6b85
58 changed files with 240 additions and 391 deletions

View file

@ -63,9 +63,9 @@ public class TestCompileJARInClassPath {
}
void writeFile(String f, String contents) throws IOException {
PrintStream s = new PrintStream(new FileOutputStream(f));
s.println(contents);
s.close();
try (PrintStream s = new PrintStream(new FileOutputStream(f))) {
s.println(contents);
}
}
void rm(String filename) throws Exception {