src/share/classes/javax/imageio/ImageReader.java

Print this page
rev 9293 : 8034998: Fix raw and unchecked lint warnings in javax.imageio
Reviewed-by:

*** 791,801 **** { return getMetadata(formatName, nodeNames, true, 0); } private IIOMetadata getMetadata(String formatName, ! Set nodeNames, boolean wantStream, int imageIndex) throws IOException { if (formatName == null) { throw new IllegalArgumentException("formatName == null!"); } --- 791,801 ---- { return getMetadata(formatName, nodeNames, true, 0); } private IIOMetadata getMetadata(String formatName, ! Set<String> nodeNames, boolean wantStream, int imageIndex) throws IOException { if (formatName == null) { throw new IllegalArgumentException("formatName == null!"); }
*** 1063,1076 **** throw new IndexOutOfBoundsException("imageIndex < getMinIndex()!"); } BufferedImage im = read(imageIndex, param); ! ArrayList thumbnails = null; int numThumbnails = getNumThumbnails(imageIndex); if (numThumbnails > 0) { ! thumbnails = new ArrayList(); for (int j = 0; j < numThumbnails; j++) { thumbnails.add(readThumbnail(imageIndex, j)); } } --- 1063,1076 ---- throw new IndexOutOfBoundsException("imageIndex < getMinIndex()!"); } BufferedImage im = read(imageIndex, param); ! ArrayList<BufferedImage> thumbnails = null; int numThumbnails = getNumThumbnails(imageIndex); if (numThumbnails > 0) { ! thumbnails = new ArrayList<>(); for (int j = 0; j < numThumbnails; j++) { thumbnails.add(readThumbnail(imageIndex, j)); } }
*** 1154,1164 **** */ public Iterator<IIOImage> readAll(Iterator<? extends ImageReadParam> params) throws IOException { ! List output = new ArrayList(); int imageIndex = getMinIndex(); // Inform IIOReadProgressListeners we're starting a sequence processSequenceStarted(imageIndex); --- 1154,1164 ---- */ public Iterator<IIOImage> readAll(Iterator<? extends ImageReadParam> params) throws IOException { ! List<IIOImage> output = new ArrayList<>(); int imageIndex = getMinIndex(); // Inform IIOReadProgressListeners we're starting a sequence processSequenceStarted(imageIndex);
*** 1185,1198 **** bi = read(imageIndex, param); } catch (IndexOutOfBoundsException e) { break; } ! ArrayList thumbnails = null; int numThumbnails = getNumThumbnails(imageIndex); if (numThumbnails > 0) { ! thumbnails = new ArrayList(); for (int j = 0; j < numThumbnails; j++) { thumbnails.add(readThumbnail(imageIndex, j)); } } --- 1185,1198 ---- bi = read(imageIndex, param); } catch (IndexOutOfBoundsException e) { break; } ! ArrayList<BufferedImage> thumbnails = null; int numThumbnails = getNumThumbnails(imageIndex); if (numThumbnails > 0) { ! thumbnails = new ArrayList<>(); for (int j = 0; j < numThumbnails; j++) { thumbnails.add(readThumbnail(imageIndex, j)); } }
*** 1795,1816 **** // Listeners // Add an element to a list, creating a new list if the // existing list is null, and return the list. ! static List addToList(List l, Object elt) { if (l == null) { ! l = new ArrayList(); } l.add(elt); return l; } // Remove an element from a list, discarding the list if the // resulting list is empty, and return the list or null. ! static List removeFromList(List l, Object elt) { if (l == null) { return l; } l.remove(elt); if (l.size() == 0) { --- 1795,1816 ---- // Listeners // Add an element to a list, creating a new list if the // existing list is null, and return the list. ! static <T> List<T> addToList(List<T> l, T elt) { if (l == null) { ! l = new ArrayList<>(); } l.add(elt); return l; } // Remove an element from a list, discarding the list if the // resulting list is empty, and return the list or null. ! static <T> List<T> removeFromList(List<T> l, T elt) { if (l == null) { return l; } l.remove(elt); if (l.size() == 0) {
*** 2459,2472 **** * accessed via the applet class loader. So first try the context * class loader to locate the resource bundle. * If that throws MissingResourceException, then try the * system class loader. */ ! ClassLoader loader = (ClassLoader) java.security.AccessController.doPrivileged( ! new java.security.PrivilegedAction() { ! public Object run() { return Thread.currentThread().getContextClassLoader(); } }); ResourceBundle bundle = null; --- 2459,2472 ---- * accessed via the applet class loader. So first try the context * class loader to locate the resource bundle. * If that throws MissingResourceException, then try the * system class loader. */ ! ClassLoader loader = java.security.AccessController.doPrivileged( ! new java.security.PrivilegedAction<ClassLoader>() { ! public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); ResourceBundle bundle = null;