From 63f490ba72bdab691b0e5e0dbee7eae006b55dcc Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 5 Jan 2011 09:42:00 +0000 Subject: [PATCH] In NPOIFS, close the file we opened in more exception cases git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1055379 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java index 8a7b683315..58d77be69a 100644 --- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java +++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java @@ -183,6 +183,14 @@ public class NPOIFSFileSystem extends BlockStore channel.close(); } throw e; + } catch(RuntimeException e) { + // Comes from Iterators etc. + // TODO Decide if we can handle these better whilst + // still sticking to the iterator contract + if(closeChannelOnError) { + channel.close(); + } + throw e; } } -- 2.39.5