src/share/classes/javax/imageio/spi/IIORegistry.java

Print this page
rev 9345 : 8035487: Fix raw and unchecked lint warnings in javax.imageio.spi
Reviewed-by:

*** 113,123 **** /** * A <code>Vector</code> containing the valid IIO registry * categories (superinterfaces) to be used in the constructor. */ ! private static final Vector initialCategories = new Vector(5); static { initialCategories.add(ImageReaderSpi.class); initialCategories.add(ImageWriterSpi.class); initialCategories.add(ImageTranscoderSpi.class); --- 113,123 ---- /** * A <code>Vector</code> containing the valid IIO registry * categories (superinterfaces) to be used in the constructor. */ ! private static final Vector<Class<?>> initialCategories = new Vector<>(5); static { initialCategories.add(ImageReaderSpi.class); initialCategories.add(ImageWriterSpi.class); initialCategories.add(ImageTranscoderSpi.class);
*** 196,208 **** public void registerApplicationClasspathSpis() { // FIX: load only from application classpath ClassLoader loader = Thread.currentThread().getContextClassLoader(); ! Iterator categories = getCategories(); while (categories.hasNext()) { ! Class<IIOServiceProvider> c = (Class)categories.next(); Iterator<IIOServiceProvider> riter = ServiceLoader.load(c, loader).iterator(); while (riter.hasNext()) { try { // Note that the next() call is required to be inside --- 196,209 ---- public void registerApplicationClasspathSpis() { // FIX: load only from application classpath ClassLoader loader = Thread.currentThread().getContextClassLoader(); ! Iterator<Class<?>> categories = getCategories(); while (categories.hasNext()) { ! @SuppressWarnings("unchecked") ! Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next(); Iterator<IIOServiceProvider> riter = ServiceLoader.load(c, loader).iterator(); while (riter.hasNext()) { try { // Note that the next() call is required to be inside
*** 232,247 **** in the privileged mode in order to be able read corresponding jar files even if file read capability is restricted (like the applet context case). */ ! PrivilegedAction doRegistration = ! new PrivilegedAction() { public Object run() { ! Iterator categories = getCategories(); while (categories.hasNext()) { ! Class<IIOServiceProvider> c = (Class)categories.next(); for (IIOServiceProvider p : ServiceLoader.loadInstalled(c)) { registerServiceProvider(p); } } return this; --- 233,249 ---- in the privileged mode in order to be able read corresponding jar files even if file read capability is restricted (like the applet context case). */ ! PrivilegedAction<Object> doRegistration = ! new PrivilegedAction<Object>() { public Object run() { ! Iterator<Class<?>> categories = getCategories(); while (categories.hasNext()) { ! @SuppressWarnings("unchecked") ! Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next(); for (IIOServiceProvider p : ServiceLoader.loadInstalled(c)) { registerServiceProvider(p); } } return this;