RFR: 8297875: jar should not compress the manifest directory entry [v2]
Lance Andersen
lancea at openjdk.org
Wed Nov 30 22:28:35 UTC 2022
On Wed, 30 Nov 2022 22:09:22 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:
>> This causes jar to not compress the `META-INF/` directory entry, for consistency with the handling of other directory entries and compliance with `APPNOTE.TXT`, and for compatibility with other zip implementations.
>
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
>
> Use TestNG, and assert on the compression method
Thanks for the quick set up updates. a few minor nit comments to make the test feel more TestNG friendly and inline with a few of our other tests.
Will approve tomorrow with some of these tweaks and giving time for some others to scan.
Thank you again for your contribution, it is appreciated :-)
test/jdk/tools/jar/ManifestDirectoryCompression.java line 52:
> 50:
> 51: /** Remove dirs & files needed for test. */
> 52: private static void cleanup(Path dir) {
This can leverage the @afterMethod annotation if the code is reworked slightly to make it more TestNG friendly
test/jdk/tools/jar/ManifestDirectoryCompression.java line 60:
> 58: }
> 59: Files.delete(dir);
> 60: } catch (IOException e) {
Have the method throw IOException and you do not need the catch block
test/jdk/tools/jar/ManifestDirectoryCompression.java line 72:
> 70: doTest(topDir.resolve("test.jar"), entry);
> 71: } finally {
> 72: cleanup(topDir);
See comment above regarding cleanup()
test/jdk/tools/jar/ManifestDirectoryCompression.java line 83:
> 81: try (JarFile jarFile = new JarFile(jar.toFile())) {
> 82: ZipEntry zipEntry = jarFile.getEntry("META-INF/");
> 83: assertEquals(zipEntry.getMethod(), ZipEntry.STORED);
Probably worth verifying zipEntry is not null so you do not get an NPE
-------------
PR: https://git.openjdk.org/jdk/pull/11441
More information about the core-libs-dev
mailing list