diff --git a/WHATSNEW b/WHATSNEW index b8c4b4ba6..ff59e6314 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -23,6 +23,10 @@ Fixed bugs: instead of a IllegalStateException in the absence of the "id" attribute. Bugzilla Report 62655 + * org.apache.tools.zip.ZipOutputStream would sometimes potentially use + an incorrect compression level for a zip entry. This is now fixed. + Bugzilla Report 62686 + Other changes: -------------- * generatekey task now supports SubjectAlternativeName during key diff --git a/src/main/org/apache/tools/zip/ZipOutputStream.java b/src/main/org/apache/tools/zip/ZipOutputStream.java index 14dc92c95..025407b41 100644 --- a/src/main/org/apache/tools/zip/ZipOutputStream.java +++ b/src/main/org/apache/tools/zip/ZipOutputStream.java @@ -867,7 +867,10 @@ public class ZipOutputStream extends FilterOutputStream { throw new IllegalArgumentException("Invalid compression level: " + level); } - hasCompressionLevelChanged = (this.level != level); + if (this.level == level) { + return; + } + hasCompressionLevelChanged = true; this.level = level; }