]> source.dussan.org Git - poi.git/commitdiff
Add missing file-close in ZipInputStreamZipEntrySource seen in some mass regression...
authorDominik Stadler <centic@apache.org>
Tue, 1 Jan 2019 20:10:51 +0000 (20:10 +0000)
committerDominik Stadler <centic@apache.org>
Tue, 1 Jan 2019 20:10:51 +0000 (20:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1850114 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java

index 0a56966d4faca3f8e81affed41cb7e94c648f9b4..ef8d20eb7651697fb591f0cacd34b835efa953c3 100644 (file)
@@ -35,7 +35,9 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
  */
 public class ZipInputStreamZipEntrySource implements ZipEntrySource {
        private final Map<String, ZipArchiveFakeEntry> zipEntries = new HashMap<>();
-       
+
+       private InputStream streamToClose;
+
        /**
         * Reads all the entries from the ZipInputStream 
         *  into memory, and don't close (since POI 4.0.1) the source stream.
@@ -50,6 +52,8 @@ public class ZipInputStreamZipEntrySource implements ZipEntrySource {
                        }
                        zipEntries.put(zipEntry.getName(), new ZipArchiveFakeEntry(zipEntry, inp));
                }
+
+               streamToClose = inp;
        }
 
        @Override
@@ -64,9 +68,11 @@ public class ZipInputStreamZipEntrySource implements ZipEntrySource {
        }
 
        @Override
-       public void close() {
+       public void close() throws IOException {
                // Free the memory
                zipEntries.clear();
+
+               streamToClose.close();
        }
 
        @Override