-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
Name: ipR10067 Date: 04/06/2001
The specification (ImageIO.write) reads:
"
...
Throws: IllegalArgumentException - if any parameter is null
"
But the method write(RenderedImage im, String formatName, File output)
throws NullPointerException instead of IllegalArgumentException.
Please see test source and log bellow.
===================== write.java =======================
import javax.imageio.ImageIO;
import java.io.IOException;
import java.io.File;
public class write{
public static void main(String argv[]) {
try {
ImageIO.write(null, null, (File)null);
System.out.println("FAILED: No exception was thrown");
} catch (IllegalArgumentException iae) {
System.out.println("PASSED: Expected exception - " + iae.toString());
} catch (java.lang.NullPointerException iae) {
System.out.println("FAILED: Wrong exception - " + iae.toString());
} catch (IOException io) {
System.out.println("Exception during writing " + io.toString());
}
}
}
============================== log =================================
> java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b58)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b58, mixed mode)
> javac write.java
> java write
FAILED: Wrong exception - java.lang.NullPointerException
This bug affects new JCK test
tests/api/javax_imageio/ImageIO/index.html#write
======================================================================