aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-04-28 09:13:08 +0000
committerPJ Fanning <fanningpj@apache.org>2023-04-28 09:13:08 +0000
commitfe3b4645b7b9b7eab10749d76fbc88adcd941c9c (patch)
tree6070a02262c2576b6264deb1d342eb89e82d1059 /poi-ooxml
parentb88f3ac0ab47f8a15a865597a0daffa87a33e65e (diff)
downloadpoi-fe3b4645b7b9b7eab10749d76fbc88adcd941c9c.tar.gz
poi-fe3b4645b7b9b7eab10749d76fbc88adcd941c9c.zip
[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
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java
index a5930919d2..3567e66074 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java
@@ -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;
}
}