Polish "Use try-with-resources to close resources automatically"
- Apply code formatting - Use try-with-resources in many other places that were missed in the pull request Closes gh-8045
This commit is contained in:
@@ -27,8 +27,7 @@ public final class Verify {
|
||||
}
|
||||
|
||||
public static void verify(File file, String entry) throws Exception {
|
||||
ZipFile zipFile = new ZipFile(file);
|
||||
try {
|
||||
try (ZipFile zipFile = new ZipFile(file)) {
|
||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
if (entries.nextElement().getName().equals(entry)) {
|
||||
@@ -37,9 +36,6 @@ public final class Verify {
|
||||
}
|
||||
throw new AssertionError("No entry " + entry);
|
||||
}
|
||||
finally {
|
||||
zipFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user