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