poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1850114 - /poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
Date Tue, 01 Jan 2019 20:10:51 GMT
Author: centic
Date: Tue Jan  1 20:10:51 2019
New Revision: 1850114

URL: http://svn.apache.org/viewvc?rev=1850114&view=rev
Log:
Add missing file-close in ZipInputStreamZipEntrySource seen in some mass regression tests

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java?rev=1850114&r1=1850113&r2=1850114&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
Tue Jan  1 20:10:51 2019
@@ -35,7 +35,9 @@ import org.apache.commons.compress.archi
  */
 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 ZipInputStreamZipEntrySourc
 			}
 			zipEntries.put(zipEntry.getName(), new ZipArchiveFakeEntry(zipEntry, inp));
 		}
+
+		streamToClose = inp;
 	}
 
 	@Override
@@ -64,9 +68,11 @@ public class ZipInputStreamZipEntrySourc
 	}
 
 	@Override
-	public void close() {
+	public void close() throws IOException {
 		// Free the memory
 		zipEntries.clear();
+
+		streamToClose.close();
 	}
 
 	@Override



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message