Repository: incubator-taverna-language Updated Branches: refs/heads/master 304a9e83d -> 26664a807
Autoclose the zip file using try-with-resources Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/commit/26664a80 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/26664a80 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/26664a80 Branch: refs/heads/master Commit: 26664a807d3fb283ff0c1f2b0821d320303fbe7e Parents: 304a9e8 Author: Ian Dunlop <ian.dun...@manchester.ac.uk> Authored: Wed Feb 24 10:52:02 2016 +0000 Committer: Ian Dunlop <ian.dun...@manchester.ac.uk> Committed: Wed Feb 24 10:52:02 2016 +0000 ---------------------------------------------------------------------- .../taverna/robundle/validator/RoValidator.java | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/26664a80/taverna-robundle/src/main/java/org/apache/taverna/robundle/validator/RoValidator.java ---------------------------------------------------------------------- diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/validator/RoValidator.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/validator/RoValidator.java index 3c8c35b..7757135 100644 --- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/validator/RoValidator.java +++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/validator/RoValidator.java @@ -87,16 +87,18 @@ public class RoValidator { Manifest manifest = bundle.getManifest(); this.aggr = manifest.getAggregates(); this.anno = manifest.getAnnotations(); - - ZipFile zip = new ZipFile(new File(path.toString())); - Enumeration<? extends ZipEntry> ent = zip.entries(); - while(ent.hasMoreElements()){ - ZipEntry entry = ent.nextElement(); - if(!entry.isDirectory()){ - items.add("/"+entry.getName()); - } - } - zip.close(); + // Autoclose the zip file + try(ZipFile zip = new ZipFile(new File(path.toString()))) { + Enumeration<? extends ZipEntry> ent = zip.entries(); + while(ent.hasMoreElements()){ + ZipEntry entry = ent.nextElement(); + if(!entry.isDirectory()){ + items.add("/"+entry.getName()); + } + } + } catch (IOException e) { + e.printStackTrace(); + } } catch (IOException e) { // TODO Auto-generated catch block System.err.println("Unable to open the bundle");