< prev index next >

src/java.desktop/share/classes/javax/imageio/ImageIO.java

Print this page

        

*** 1350,1359 **** --- 1350,1364 ---- if (input == null) { throw new IllegalArgumentException("input == null!"); } ImageInputStream stream = createImageInputStream(input); + + if (stream == null) { + throw new IIOException("Can't create an ImageInputStream!"); + } + BufferedImage bi = read(stream); if (bi == null) { stream.close(); } return bi;
*** 1396,1405 **** --- 1401,1415 ---- istream = input.openStream(); } catch (IOException e) { throw new IIOException("Can't get input stream from URL!", e); } ImageInputStream stream = createImageInputStream(istream); + + if (stream == null) { + throw new IIOException("Can't create an ImageInputStream!"); + } + BufferedImage bi; try { bi = read(stream); if (bi == null) { stream.close();
*** 1533,1542 **** --- 1543,1556 ---- stream = createImageOutputStream(output); } catch (IOException e) { throw new IIOException("Can't create output stream!", e); } + if (stream == null) { + throw new IIOException("Can't create an ImageOutputStream!"); + } + try { return doWrite(im, writer, stream); } finally { stream.close(); }
*** 1575,1584 **** --- 1589,1602 ---- stream = createImageOutputStream(output); } catch (IOException e) { throw new IIOException("Can't create output stream!", e); } + if (stream == null) { + throw new IIOException("Can't create an ImageOutputStream!"); + } + try { return doWrite(im, getWriter(im, formatName), stream); } finally { stream.close(); }
< prev index next >