RFR JDK-8211728,JarFile::versionedStream() does not filter META-INF resources in versioned stream
Alan Bateman
Alan.Bateman at oracle.com
Sat Oct 6 07:17:13 UTC 2018
On 05/10/2018 17:48, Xueming Shen wrote:
> Hi
>
> Please help review the change for JDK-8211728
>
> issue: https://bugs.openjdk.java.net/browse/JDK-8211728
> webrev: http://cr.openjdk.java.net/~sherman/8211728/webrev
>
> The "intention" of JEP 238 is that the resources under META-INF
> can't/shouldn't
> be versioned. But it appears this is not documented & specified
> clearly/explicitly.
> And the JarFile implementation has loophole dealing with this case.
> The spec
> clarification is being traced/addressed separately via JDK-8211758.
> The change
> proposed here is to fix the JarFile implementation.
>
> Note: the direct trigger of the bug is that versionedStream() does not
> expect the
> possibility VersinedEntry() might return null when the entry is
> actually under
> META-INF/versions/{n}/META-INF, in which it has a "basename" of
> META-INF/xxx
> but doesn't have a real entry under /META-INF (in which the
> getVersionEntry(...)
> is invoked with (name="META-INF/xxx", je=null).
The update to versionedStream looks okay but the test seems to be
checking JarFile::stream rather than versionedStream. For the bug we
need the stream to end without NPE and we also need to check that there
isn't an element for META-INF/Foo.class (because this is not in the base
section).
-Alan
More information about the core-libs-dev
mailing list