ZipEntry

Eirik Bjørsnøs eirbjo at gmail.com
Tue Dec 12 20:57:09 UTC 2023


Alan,

ZipOutputStream is a relatively high-level API for producing ZIP files.
There are many shapes and corner cases allowed by APPNOTE.TXT which
ZipOutputStream has no means to produce. So while exposing the "external
file attributes" field (which was incorrectly named "extraAttributes" in
ZipEntry) is perhaps not harmful in itself, the question is: Where do we
stop?

It's worth noting that the ZipFileSystem API has the
"enablePosixFileAttributes" env option which lets you set POSIX permissions
on ZIP file entries using Files.setPosixFilePermissions()

The following OpenJDK test can serve as an example:

https://github.com/openjdk/jdk/blob/master/test/jdk/sun/security/tools/jarsigner/PosixPermissionsTest.java#L151

Cheers,
Eirik,

On Tue, Dec 12, 2023 at 9:17 PM Alan Snyder <javalists at cbfiddle.com> wrote:

> ZipEntry is a public class and I am aware that it is used outside the JDK.
> Presumably that is not a problem.
>
> I’m wondering why the class stores the external file attributes field but
> does not provide public accessors for it.
>
> I would find it useful to have access to this field. I would rather not
> have to switch to using a third party library just for this reason.
>
> I understand that the interpretation of the external file attributes is
> not standardized, but the field itself is defined in the standard
> cited by the package info page, so I don’t see the harm in making it
> accessible without interpretation.
>
>   Alan
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20231212/1dca24ef/attachment.htm>


More information about the core-libs-dev mailing list