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 <[email protected] <mailto:[email protected]>> 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;



Reply via email to