RFR: 8303972: Make test/jdk/jdk/nio/zipfs/TestLocOffsetFromZip64EF.java independent of the zip command line [v4]

Eirik Bjorsnos duke at openjdk.org
Fri Mar 17 19:26:42 UTC 2023


On Fri, 17 Mar 2023 16:45:40 GMT, Lance Andersen <lancea at openjdk.org> wrote:

> I think I would include an additional entry in the zip just as an extra sanity check that we can navigate an additional entry

Added an additional entry as suggested and checked that is was navigated.

> It is also worth noting that the LOC will still contain an extra field with the unknown tag of 0x9902 while the CEN is being changed to use Zip64, 0x1

This stray opaque extra field should not be any issue, but just in case, I moved the ZipFIle.setExtra until after the LOC is written, so now only the CEN will have the Zip64 extra field.

> The length of the zip64 extra field is going to be 28. I would suggest making this a bit clearer and adding a field/constant which is set to 28 for clarity to make it easier for those who might look at this code later

I believe this should be well-described now between the constants and the `makeOpaqueExtraField` method.

> I would probably make 0x1 a constant like the unknown tag.

Extracted a constant with a comment.

> It would be good to beef up the comment as the byte array written by ZipEntry::setExtra is set to the unknown tag for the Tag and the length is set to 28 which includes all of the Zip64 extra fields

Opted to extract a method to create the opaque extra field since that allows for more comments and declutters the calling method.

-------------

PR: https://git.openjdk.org/jdk/pull/12979


More information about the nio-dev mailing list