Using NIO2 for writing zip file entries without corresponding folder entries
Alan Bateman
Alan.Bateman at oracle.com
Wed Oct 10 12:58:56 UTC 2018
On 10/10/2018 13:00, Rafael Winterhalter wrote:
> You are right with that it does emulate missing folders in the source
> file.
>
> I have a use case where I patch a zip file with some additional
> entries that are placed in directories of files that already exist in
> the zip file. To do so, I have to add the directories for the added files.
I just tried a quick test with a zip file containing one entry x/foo.txt
(created with zip -D to not create directory entries). With the zip file
system then I replaced x/foo.txt, then a second test to create x/bar.txt
and I didn't see any issues. Is that close to what you are doing? I
suspect most usages of the zip file system provider are read-only (javac
being the biggest user) and it's possible there are issues or short
comings when writing or updating that haven't come up. If you can
provides the instructions or a simple test case to show what you are
seeing then it would be useful. Also which JDK release is this?
> Doing so confuses the processing backend which does not filter the
> folder entries but treats them as normal files which causes this
> processor to crash when treating them as regular files.
This sounds like a bug in whatever this system is as many zip tools will
create directory entries by default.
-Alan
More information about the nio-dev
mailing list