[OpenJDK 2D-Dev] RFR: 8154860 ImageIO.getImageReadersByFormatName() fails when jai_imageio is in the classpath

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri May 20 23:47:37 UTC 2016


On 21.05.16 0:42, Phil Race wrote:
> That is too broad and I recall that Mark R. was pretty keen that SCE
> should always be propagated.
> So catching it only in the applet case was probably a compromise (I
> don't remember exactly)

This code was added by the quite similar reason, the bug in one of the 
plugins.
JDK-6342404: Misconfigured plugin could take down the whole Image I/O 
system.

https://bugs.openjdk.java.net/browse/JDK-6342404

Current fix looks fine, but probably we have some general rules in jdk 
to handle such issues?

>
> -phil.
>
> On 5/20/2016 2:09 PM, Sergey Bylokhov wrote:
>> Hi, Phil
>> Probably it will be simpler to change the code in
>> IIORegistry.registerApplicationClasspathSpis?
>>
>>         } catch (ServiceConfigurationError err) {
>>             if (System.getSecurityManager() != null) {
>>                 // In the applet case, we will catch the  error so
>>                 // registration of other plugins can  proceed
>>                 err.printStackTrace();
>>             } else {
>>                 // In the application case, we will  throw the
>>                 // error to indicate app/system  misconfiguration
>>                 throw err;
>>             }
>>         }
>>
>> We can change ServiceConfigurationError to Throwable + stacktrace.
>>
>> On 20.05.16 23:07, Phil Race wrote:
>>> Please review the following workaround for :-
>>> https://bugs.openjdk.java.net/browse/JDK-8154860
>>>
>>> -phil.
>>>
>>> ---
>>> a/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java
>>> +++
>>> b/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java
>>> @@ -770,7 +770,12 @@
>>>          poset.add(provider);
>>>          if (provider instanceof RegisterableService) {
>>>              RegisterableService rs = (RegisterableService)provider;
>>> +            try {
>>>              rs.onRegistration(registry, category);
>>> +            } catch (Throwable t) {
>>> +                System.err.println("Caught and handled this
>>> exception :");
>>> +                t.printStackTrace();
>>> +            }
>>>          }
>>>
>>>          return !present;
>>>
>>
>>
>


-- 
Best regards, Sergey.



More information about the 2d-dev mailing list