Please refer to JDK-8250968<https://bugs.openjdk.org/browse/JDK-8250968> which 
why the field in question was added.  If you are interested in additional 
support,  you can open an enhancement request for consideration.

Best
Lance

On Dec 12, 2023, at 4:15 PM, Alan Snyder 
<javali...@cbfiddle.com<mailto:javali...@cbfiddle.com>> wrote:



On Dec 12, 2023, at 12:57 PM, Eirik Bjørsnøs 
<eir...@gmail.com<mailto:eir...@gmail.com>> wrote:

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?


Right now, I’m more interested in reading zip files, but to answer your 
question: we can stop at any point.


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()


I’m more interested in the symlink bit, and do not currently have any need to 
use ZipFileSystem.

I’m wondering, though, why it is OK to access information via ZipFileSystem and 
not directly via ZipEntry?



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 
<javali...@cbfiddle.com<mailto:javali...@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

[cid:E1C4E2F0-ECD0-4C9D-ADB4-B16CA7BCB7FC@home]






Lance Andersen | Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
lance.ander...@oracle.com<mailto:lance.ander...@oracle.com>



Reply via email to