J2SE Version (please include all output from java -version flag):
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b55)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b55, mixed mode, sharing)
Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one)
don't know
Bug Description:
javax.imageio.ImageIO possible handle leak in some methods.
"High level" methods to read/write files do not close streams
in case of exceptions. See below.
Steps to Reproduce (be specific):
For example the method javax.imageio.ImageIO.write(RenderedImage,String,File)
contains the following code:
public static boolean write(RenderedImage im, String formatName, File output)
throws IOException {
...
ImageOutputStream stream = null;
try {
output.delete();
stream = createImageOutputStream(output);
} catch (IOException e) {
throw new IIOException("Can't create output stream!", e);
}
boolean val = write(im, formatName, stream);
stream.close(); // not called if above method throws exception!
return val;
}
If write() throws an exception, stream.close(); will never be called and
the underlying operating system handle will never be closed.