summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java8
1 files changed, 8 insertions, 0 deletions
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;
}
}