ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ant] helfper opened a new pull request #145: Override ZipOutputStream.write(int)
Date Sat, 13 Mar 2021 09:49:32 GMT

helfper opened a new pull request #145:
URL: https://github.com/apache/ant/pull/145


   `java.util.zip.ZipOutputStream` extends from `java.util.zip.DeflaterOutputStream` which
overrides `void write(int b)` to redirect its calls to `void write(byte[] b, int off, int
len)`.
   
   `org.apache.tools.zip.ZipOutputStream` doesn't extend the same class and currently doesn't
override `void write(int b)`. This means that calls to this method end up in `FilterOutputStream.write(int
b)`, which in turn passes them through to the underlying `OutputStream`. This bypasses all
the logic in `ZipOutputStream.write(byte[] b, int offset, int len)` (deflation and whatnot)
which produces corrupted ZIP files.
   
   One example where the method `void write(int b)` is ultimately invoked is by calling `java.util.jar.Manifest.write(zipOutputStream)`.
   
   This PR fixes this by overriding the method `void write(int b)` in `org.apache.tools.zip.ZipOutputStream`
in the same way as `java.util.zip.DeflaterOutputStream` does.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message