mirror of https://github.com/apache/poi.git
Add missing file-close in ZipInputStreamZipEntrySource seen in some mass regression tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1850114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bfecad39e5
commit
fa24471916
|
@ -35,7 +35,9 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||||
*/
|
*/
|
||||||
public class ZipInputStreamZipEntrySource implements ZipEntrySource {
|
public class ZipInputStreamZipEntrySource implements ZipEntrySource {
|
||||||
private final Map<String, ZipArchiveFakeEntry> zipEntries = new HashMap<>();
|
private final Map<String, ZipArchiveFakeEntry> zipEntries = new HashMap<>();
|
||||||
|
|
||||||
|
private InputStream streamToClose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads all the entries from the ZipInputStream
|
* Reads all the entries from the ZipInputStream
|
||||||
* into memory, and don't close (since POI 4.0.1) the source stream.
|
* 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));
|
zipEntries.put(zipEntry.getName(), new ZipArchiveFakeEntry(zipEntry, inp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
streamToClose = inp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,9 +68,11 @@ public class ZipInputStreamZipEntrySource implements ZipEntrySource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() throws IOException {
|
||||||
// Free the memory
|
// Free the memory
|
||||||
zipEntries.clear();
|
zipEntries.clear();
|
||||||
|
|
||||||
|
streamToClose.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue