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

Lance Andersen lancea at openjdk.java.net
Thu Nov 11 17:19:06 UTC 2021


On Thu, 11 Nov 2021 12:50:30 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> 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```

I just tweaked the comment slightly

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

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


More information about the core-libs-dev mailing list