RFR: 8304014: Convert test/jdk/java/util/zip/ZipFile/CorruptedZipFiles.java to junit [v5]
Lance Andersen
lancea at openjdk.org
Sun Apr 2 14:13:33 UTC 2023
On Fri, 31 Mar 2023 19:58:24 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:
>> test/jdk/java/util/zip/ZipFile/CorruptedZipFiles.java line 192:
>>
>>> 190: /*
>>> 191: * Validate that a ZipException is thrown when the 'End of Central Directory'
>>> 192: * (END) header has a CEN offset incoherent with the position calculated
>>
>> Not sure _incoherent_ is the best term.
>>
>> perhaps something along the lines:
>>
>> header contains an invalid CEN Directory starting offset.....
>
> I remember my struggles trying to write this one in the first place. The code says:
>
>
> long cenpos = end.endpos - end.cenlen; // position of CEN table
> // Get position of first local file (LOC) header, taking into
> // account that there may be a stub prefixed to the zip file.
> locpos = cenpos - end.cenoff;
> if (locpos < 0) {
> zerror("invalid END header (bad central directory offset)");
> }
> ```
>
> so I ended up trying to express this equation in words, which is maybe not so successful. I don't see _incoherent_ as the main problem, if it was we could just use _inconsistent_.
>
> Do you have a better concrete suggestion?
I would keep it simple and indicate that the offset of start of central directory field within the End Header was given an invalid value
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/12563#discussion_r1155318941
More information about the core-libs-dev
mailing list