RFR: 8215788: Clarify JarInputStream Manifest access

Lance Andersen lancea at openjdk.org
Tue Sep 13 17:24:49 UTC 2022


On Thu, 1 Sep 2022 17:27:23 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> It's better. Do you need to explicitly say "For all other cases"?
>> 
>> My original comment was more about explaining `getManifest()` and `getNextEntry()` in the same if. It's still doable.
>
>> It's better. Do you need to explicitly say "For all other cases"?
> 
> I thought it is worth being specific,  but happy to leave it out if you and others prefer
>> 
>> My original comment was more about explaining `getManifest()` and `getNextEntry()` in the same if. It's still doable.
> 
> I think the challenge is there is not an exact match to the behavior between `getManifest()` and `getNext[Jar]Entry()`.    We also have the case if the manifest is the first entry and META-INF/ is the 2nd or later entry, then  META-INF/ will be returned by `JarInputStream`.  ` ZipInputStream` will return all entries which differs from `JarInputStream` so thought it made sense to be specific but perhaps I am overthinking it.

I could do tweak further to say:

_`getManifest()` will return the Manifest if it is the first entry or META-INF/ is the first entry and the Manifest is the second entry within the Jar file.   When the Manifest is returned by `getManifest()`,  the `getNextEntry()` and `getNextJarEntry()` methods will not return the Manifest_

Is that more what you were thinking?

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

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



More information about the security-dev mailing list