diff --git a/WHATSNEW b/WHATSNEW index ea3f75a0f..f188f264c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -60,6 +60,10 @@ Fixed bugs: when applied to big outputs. Bugzilla Report 57341 + * removed spurious warning about inclosed ZipFiles when reading the + archive failed. + Port of https://issues.apache.org/jira/browse/COMPRESS-297 + Other changes: -------------- diff --git a/src/main/org/apache/tools/zip/ZipFile.java b/src/main/org/apache/tools/zip/ZipFile.java index 0771c1fa8..7a2c99268 100644 --- a/src/main/org/apache/tools/zip/ZipFile.java +++ b/src/main/org/apache/tools/zip/ZipFile.java @@ -130,7 +130,7 @@ public class ZipFile { /** * Whether the file is closed. */ - private boolean closed; + private volatile boolean closed; // cached buffers private final byte[] DWORD_BUF = new byte[DWORD]; @@ -216,9 +216,9 @@ public class ZipFile { resolveLocalFileHeaderData(entriesWithoutUTF8Flag); success = true; } finally { + closed = !success; if (!success) { try { - closed = true; archive.close(); } catch (final IOException e2) { // swallow, throw the original exception instead