]> source.dussan.org Git - poi.git/commitdiff
Ensure that file handles are closed for encrypted files
authorDominik Stadler <centic@apache.org>
Sun, 26 Aug 2018 11:41:20 +0000 (11:41 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 26 Aug 2018 11:41:20 +0000 (11:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1839197 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java

index 7f4ab04b2949245800a967d74bb3146da5135cd8..e97a49eda75e90df04f4be056d338852170ce419 100644 (file)
@@ -110,6 +110,10 @@ public class SlideShowFactory {
                 return createXSLFSlideShow(stream);
             } finally {
                 IOUtils.closeQuietly(stream);
+
+                // as we processed the full stream already, we can close the filesystem here
+                // otherwise file handles are leaked
+                root.getFileSystem().close();
             }
         }
 
index 7ac79673407c432aff20525feb12cd9c2f6de200..1386b8fbbaebc5aa28dd67141942340344361a54 100644 (file)
@@ -110,6 +110,10 @@ public class WorkbookFactory {
                 return createXSSFWorkbook(stream);
             } finally {
                 IOUtils.closeQuietly(stream);
+
+                // as we processed the full stream already, we can close the filesystem here
+                // otherwise file handles are leaked
+                root.getFileSystem().close();
             }
         }
 
@@ -137,7 +141,7 @@ public class WorkbookFactory {
      * <p>Note that in order to properly release resources the
      *  Workbook should be closed after use.</p>
      *
-     *  @param pkg The {@link OPCPackage} opened for reading data.
+     *  @param pkg The {@link org.apache.poi.openxml4j.opc.OPCPackage} opened for reading data.
      *
      *  @return The created Workbook
      *