Use try with resources instead of try-finally
See gh-39259
This commit is contained in:
parent
cb26c31dd6
commit
316b415e95
|
@ -413,7 +413,7 @@ class NestedJarFileTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> collectComments(JarFile jarFile) throws IOException {
|
private List<String> collectComments(JarFile jarFile) throws IOException {
|
||||||
try {
|
try (jarFile) {
|
||||||
List<String> comments = new ArrayList<>();
|
List<String> comments = new ArrayList<>();
|
||||||
Enumeration<JarEntry> entries = jarFile.entries();
|
Enumeration<JarEntry> entries = jarFile.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
|
@ -424,9 +424,6 @@ class NestedJarFileTests {
|
||||||
}
|
}
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
jarFile.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue