[jdk8u-dev] RFR: 8298108: Add a regression test for JDK-8297684

Severin Gehwolf sgehwolf at openjdk.org
Tue Apr 4 19:03:19 UTC 2023


On Tue, 4 Apr 2023 18:08:27 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:

>> Please review this backport of the regression test for a critical fix which we've included with the January CPU update. The fix was https://bugs.openjdk.org/browse/JDK-8280890
>> 
>> This patch adds an additional regression test which was seen in the wild with JDK 17. The patch isn't clean since the test library in jdk8u is different so needed a bit of a different setup routine for getting the jar with the provider created. Additionally, in jdk 8 the property to add providers is setting `java.ext.dirs=...` over `java.locale.providers=SPI` in later JDKs.
>> 
>> Testing: The test passes for me on the current dev tree and fails with the fix from JDK-8280890 reverted.
>> 
>> Thoughts?
>
> jdk/test/java/security/SignedJar/spi-calendar-provider/TestSPISigned.java line 95:
> 
>> 93:             Files.createDirectory(SERVICES_DIR_TARGET);
>> 94:             Files.copy(PROVIDER_SOURCE, PROVIDER_TARGET);
>> 95:             JarUtils.createJarFile(UNSIGNED_JAR, PROVIDER_DIR);
> 
> I take it the JAR file does not need to be updated with the META-INF directory (11u has `JarUtils.updateJarFile(UNSIGNED_JAR, META_INF_DIR);`) because it is instead located via `-Djava.ext.dirs`?

This has to do with different test libraries in place in 8u. `JarUtils.createJarFile()` here creates a jar file based on a directory (in this case the `test.classes` dir), where we already have the `*.class` files and we copy the `META-INF` folder from the test sources there. The javadoc of `createJarFile()` has:


Creates a JAR file from the contents of a directory.

Equivalent to {@code jar cf <jarfile> -C <dir> .}


So we create the right jar file with the META-INF directory included right from the start (as compared to the 11u version, where a jar file is being created *without* `META-INF/services` files and then updated with `META-INF` bits).

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

PR Review Comment: https://git.openjdk.org/jdk8u-dev/pull/269#discussion_r1157651214


More information about the jdk8u-dev mailing list