diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-11 13:16:46 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-11 13:16:46 +0700 |
commit | 35acb11f77a4649fc844676693e1b6a5adc7fab6 (patch) | |
tree | def1342302541f852f76cca2d54577276aef000e /org.aspectj.ajdt.core/src | |
parent | 5a415f27aea587b7d74ced2a48b35db6f8e6973e (diff) | |
download | aspectj-35acb11f77a4649fc844676693e1b6a5adc7fab6.tar.gz aspectj-35acb11f77a4649fc844676693e1b6a5adc7fab6.zip |
AjBuildManager: use try with resources in 2 places
I was debugging something in ModuleTests, trying to find out if there
are resource leaks. They were not in this class but in FileUtil - see
next commit. However, the little refactoring here does not hurt either.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'org.aspectj.ajdt.core/src')
-rw-r--r-- | org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index fb086e9f3..87df28f0c 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -476,9 +476,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } private void copyResourcesFromJarFile(File jarFile) throws IOException { - JarInputStream inStream = null; - try { - inStream = new JarInputStream(new FileInputStream(jarFile)); + try (JarInputStream inStream = new JarInputStream(new FileInputStream(jarFile))) { while (true) { ZipEntry entry = inStream.getNextEntry(); if (entry == null) { @@ -496,10 +494,6 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour inStream.closeEntry(); } - } finally { - if (inStream != null) { - inStream.close(); - } } } |