Browse Source

[bug-66584] ensure ZipPackage closes input stream when exceptions happen

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1909467 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_4
PJ Fanning 1 year ago
parent
commit
fe3b4645b7

+ 1
- 3
poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java View File

@@ -127,11 +127,9 @@ public final class ZipPackage extends OPCPackage {
*/
ZipPackage(InputStream in, PackageAccess access) throws IOException {
super(access);
ZipArchiveThresholdInputStream zis = ZipHelper.openZipStream(in); // NOSONAR
try {
try (ZipArchiveThresholdInputStream zis = ZipHelper.openZipStream(in)) {
this.zipArchive = new ZipInputStreamZipEntrySource(zis);
} catch (final IOException | RuntimeException e) {
IOUtils.closeQuietly(zis);
throw e;
}
}

Loading…
Cancel
Save