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

Phil Race philip.race at oracle.com
Fri May 20 21:03:30 UTC 2016


The jai_imageio code parses the version string before
it does anything with the result. And the only thing
it intends to do is tweak the registruy ordering or
remove itself if it thinks the JDK version is high enough.
So I don't see the harm in this versus not adding it to
the registry at all.

Theoretically a different plugin that had a fatal error
as a result of this probably should not be registered
but there can't be existing examples of that on JDK 1.8
and even if there were a problem on 9 they'll get
the exception printed ..

-phil.

On 05/20/2016 01:55 PM, Brian Burkhalter wrote:
> These statements
>
>       map.put(provider.getClass(), provider);
>       poset.add(provider);
>
> occur before the “ if (provider instanceof RegisterableService)” 
> block. Do we really want the provider added to that map and set if the 
> Throwable occurs?
>
> Brian
>
> On May 20, 2016, at 1:07 PM, Phil Race <philip.race at oracle.com 
> <mailto:philip.race at oracle.com>> 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;
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160520/f3b233ef/attachment.html>


More information about the 2d-dev mailing list