Use try-with-resources instead of manual try/finally

This commit is contained in:
Alexander Udalov
2017-04-01 00:06:30 +03:00
parent 08b50cab08
commit 463bbbd386
8 changed files with 29 additions and 60 deletions
@@ -132,8 +132,7 @@ public class CompileEnvironmentUtil {
}
private static void copyJarImpl(JarOutputStream stream, File jarPath) throws IOException {
JarInputStream jis = new JarInputStream(new FileInputStream(jarPath));
try {
try (JarInputStream jis = new JarInputStream(new FileInputStream(jarPath))) {
while (true) {
JarEntry e = jis.getNextJarEntry();
if (e == null) {
@@ -145,9 +144,6 @@ public class CompileEnvironmentUtil {
}
}
}
finally {
jis.close();
}
}
@NotNull