diff options
author | Dominik Stadler <centic@apache.org> | 2018-04-04 19:41:10 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2018-04-04 19:41:10 +0000 |
commit | 166437912adb25bebb27d4e7d39b4b6b87cb1ba0 (patch) | |
tree | e93a9b8fa504e5820de12fe3b9bf58987a84fbd3 /src/java/org/apache | |
parent | a54aa3864e99c28a355a5f4ed66221506305fc88 (diff) | |
download | poi-166437912adb25bebb27d4e7d39b4b6b87cb1ba0.tar.gz poi-166437912adb25bebb27d4e7d39b4b6b87cb1ba0.zip |
Bug 62165: Do not close stream when opening succeeds
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1828377 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java b/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java index 619984fdc5..0d2abb1f25 100644 --- a/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java +++ b/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java @@ -114,8 +114,14 @@ public class OldExcelExtractor implements Closeable { : new BufferedInputStream(biffStream, 8); if (FileMagic.valueOf(bis) == FileMagic.OLE2) { - try (NPOIFSFileSystem poifs = new NPOIFSFileSystem(bis)) { + NPOIFSFileSystem poifs = new NPOIFSFileSystem(bis); + try { open(poifs); + toClose = poifs; // Fixed by GR, we should not close it here + } finally { + if (toClose == null) { + poifs.close(); + } } } else { ris = new RecordInputStream(bis); |