On Fri, 25 Oct 2024 21:06:28 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:

>> test/jdk/javax/imageio/spi/AppletContextTest/IIOPluginTest.java line 42:
>> 
>>> 40:         } catch (ServiceConfigurationError sce) {
>>> 41:             System.out.println("Expected ServiceConfigurationError \n" 
>>> + sce);
>>> 42:             System.out.println("Test Passed");
>> 
>> Previously, `ServiceConfigurationError` wasn't caught and, as far as I 
>> understand, wasn't expected; if it were thrown, the test would fail. Why is 
>> the logic different now?
>
> When SM is removed, test fails with java.util.ServiceConfigurationError: 
> javax.imageio.spi.ImageReaderSpi:Provider BadReaderPluginSpi not found. This 
> is the expected behavior without SM. 
> 
> When SM is present this error is swallowed because otherwise a erroneous 
> plugin could cause a VM-wide problem. Now that SM is removed, the test 
> (IIOPluginTest.java)
> has been updated to expect ServiceConfigurationError.
> 
> AFAIK, there isn't another test which checks this code path hence it has been 
> repurposed and retained.

Yes, perhaps there's some more general test for this in java.base, but there's 
nothing wrong with verifying it here, even though it is sort of backward from 
what the test previously verified.
Probably the test could always have tested both cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21498#discussion_r1817428928

Reply via email to