8217385: JTREG: Clean up, make sure to close resources
Reviewed-by: tschatzl, sangheki
This commit is contained in:
parent
29021027db
commit
3d13ab6882
@ -156,6 +156,7 @@ public class TestHumongousClassLoader {
|
||||
URLClassLoader urlLoader = new URLClassLoader(url);
|
||||
|
||||
Class<?> simpleClassLoaderClass = urlLoader.loadClass(SIMPLE_CLASSLOADER_NAME);
|
||||
urlLoader.close();
|
||||
|
||||
ClassLoader simpleClassLoader = (ClassLoader) simpleClassLoaderClass
|
||||
.getConstructor(java.lang.ClassLoader.class)
|
||||
|
@ -95,7 +95,7 @@ final public class LogParser {
|
||||
}
|
||||
|
||||
private PlabReport parseLines() throws NumberFormatException {
|
||||
Scanner lineScanner = new Scanner(log);
|
||||
try (Scanner lineScanner = new Scanner(log)) {
|
||||
PlabReport plabReport = new PlabReport();
|
||||
Optional<Long> gc_id;
|
||||
while (lineScanner.hasNextLine()) {
|
||||
@ -126,6 +126,7 @@ final public class LogParser {
|
||||
}
|
||||
return plabReport;
|
||||
}
|
||||
}
|
||||
|
||||
private static Optional<Long> getGcId(String line, Pattern pattern) {
|
||||
Matcher number = pattern.matcher(line);
|
||||
|
@ -38,7 +38,7 @@ public class TestGCBasher {
|
||||
HashMap<String, ClassInfo> deps = new HashMap<>();
|
||||
|
||||
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
|
||||
Stream<Path> s = Files.walk(fs.getPath("/"));
|
||||
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")) {
|
||||
@ -49,6 +49,7 @@ public class TestGCBasher {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (args.length != 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user