RFR: 8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File

Claes Redestad redestad at openjdk.java.net
Thu Nov 11 12:56:34 UTC 2021


On Thu, 11 Nov 2021 12:25:38 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Hi Jaikiran,
>> 
>> The comment is correct
>
> Thank you for that clarification.  The "addSlash" param being "false" in the call below that comment is what made me think that the comment had a typo. I read that code in a bit more detail now and I see what that comment means. It essentially says that it's now issuing a call to find a entry position (if it exists) for the name ending with a "/" character.

The comment is a bit too fuzzy. What's happening here is we searched for `foo` and found a match for `foo/` - but we can't be sure there's no exact entry `foo` later on in the hash bucket, so we (somewhat inefficiently) redo the search for `foo` without the trailing slash parameter.

I suggest clarifying to something like this:
```  // name + "/" entry found, keep looking for and prefer an entry which exactly matches name```

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

PR: https://git.openjdk.java.net/jdk/pull/6342


More information about the core-libs-dev mailing list