< prev index next >

test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasher.java

8217385: JTREG: Clean up, make sure to close resources

*** 36,53 **** public class TestGCBasher { private static void parseClassFiles() throws IOException { HashMap<String, ClassInfo> deps = new HashMap<>(); FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); ! Stream<Path> s = Files.walk(fs.getPath("/")); ! for (Path p : (Iterable<Path>)s::iterator) { ! if (p.toString().endsWith(".class") && ! !p.getFileName().toString().equals("module-info.class")) { ! byte[] data = Files.readAllBytes(p); ! Decompiler d = new Decompiler(data); ! ClassInfo ci = d.getClassInfo(); ! deps.put(ci.getName(), ci); } } } public static void main(String[] args) throws IOException { --- 36,54 ---- public class TestGCBasher { private static void parseClassFiles() throws IOException { HashMap<String, ClassInfo> deps = new HashMap<>(); FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); ! try (Stream<Path> s = Files.walk(fs.getPath("/"))) { ! for (Path p : (Iterable<Path>)s::iterator) { ! if (p.toString().endsWith(".class") && ! !p.getFileName().toString().equals("module-info.class")) { ! byte[] data = Files.readAllBytes(p); ! Decompiler d = new Decompiler(data); ! ClassInfo ci = d.getClassInfo(); ! deps.put(ci.getName(), ci); ! } } } } public static void main(String[] args) throws IOException {
< prev index next >