RFR: 8319668: Fixup of jar filename typo in BadFactoryTest.sh
Eirik Bjorsnos
duke at openjdk.org
Wed Nov 22 11:35:04 UTC 2023
On Tue, 21 Nov 2023 19:59:16 GMT, Gaurav Chaudhari <duke at openjdk.org> wrote:
>> Looks okay. This test is begging to be re-written in Java, maybe some day.
>>
>> I assume the copyright header will be updated before this change is integrated.
>
>> Looks okay. This test is begging to be re-written in Java, maybe some day.
>>
>> I assume the copyright header will be updated before this change is integrated.
>
> Hi @AlanBateman, do I have to update the copyright year to 2023 manually and amend the commit before `/integrate` ?
@Deigue
I was able to update `BadFactoryTest.java` to work as a pure Java test by adding the following jtreg header before the imports:
/*
* @test
* @bug 8196959
* @summary BadFactory that results in NPE being thrown from ScriptEngineManager
* @library /javax/script/JDK_8196959
* @build BadFactory BadFactoryTest
* @run main/othervm BadFactoryTest
* @run main/othervm -Djava.security.manager=allow BadFactoryTest
*/
I think we should add some code in the main method which validates that the BadFactory ScriptEngineFactory is loaded. (This validation would have caught the jar file typo):
ScriptEngineManager m = new ScriptEngineManager();
m.getEngineFactories().stream()
.filter(c -> c.getClass() == BadFactory.class)
.findAny()
.orElseThrow(() -> new IllegalStateException("Expected to find BadFactory"));
Would you like to include these changes in your PR? If not, I'm happy to create a separate PR to convert this test to Java.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16585#issuecomment-1822599642
More information about the core-libs-dev
mailing list