| @@ -130,10 +130,8 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| } else { | } else { | ||||
| // we have a file. create a stream for it | // we have a file. create a stream for it | ||||
| FileInputStream inFileStream | |||||
| = new FileInputStream(element); | |||||
| try { | |||||
| try (FileInputStream inFileStream | |||||
| = new FileInputStream(element)) { | |||||
| if (element.getName().endsWith(".class")) { | if (element.getName().endsWith(".class")) { | ||||
| // create a data input stream from the jar | // create a data input stream from the jar | ||||
| @@ -144,8 +142,6 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| nextElement = javaClass; | nextElement = javaClass; | ||||
| } | } | ||||
| } finally { | |||||
| inFileStream.close(); | |||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -222,8 +222,7 @@ public class jlink { | |||||
| if (!f.exists()) { | if (!f.exists()) { | ||||
| return; | return; | ||||
| } | } | ||||
| ZipFile zipf = new ZipFile(f); | |||||
| try { | |||||
| try (ZipFile zipf = new ZipFile(f)) { | |||||
| Enumeration entries = zipf.entries(); | Enumeration entries = zipf.entries(); | ||||
| while (entries.hasMoreElements()) { | while (entries.hasMoreElements()) { | ||||
| @@ -268,8 +267,6 @@ public class jlink { | |||||
| output.closeEntry(); | output.closeEntry(); | ||||
| } | } | ||||
| } | } | ||||
| } finally { | |||||
| zipf.close(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -196,16 +196,13 @@ public class ResourceList extends DataType implements ResourceCollection { | |||||
| crh.setFilterChains(filterChains); | crh.setFilterChains(filterChains); | ||||
| crh.setProject(getProject()); | crh.setProject(getProject()); | ||||
| Union streamResources = new Union(); | Union streamResources = new Union(); | ||||
| BufferedReader reader = new BufferedReader(crh.getAssembledReader()); | |||||
| try { | |||||
| try (BufferedReader reader = new BufferedReader(crh.getAssembledReader())) { | |||||
| streamResources.setCache(true); | streamResources.setCache(true); | ||||
| String line = null; | String line = null; | ||||
| while ((line = reader.readLine()) != null) { | while ((line = reader.readLine()) != null) { | ||||
| streamResources.add(parse(line)); | streamResources.add(parse(line)); | ||||
| } | } | ||||
| } finally { | |||||
| reader.close(); | |||||
| } | } | ||||
| return streamResources; | return streamResources; | ||||