-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
Name: ipR10067 Date: 05/24/2001
The description for static method getWriterMIMETypes()
of the class javax.imageio.ImageIO reads:
"Returns an array of Strings listing all of the MIME types
understood by the current set of registered writers.
Returns: an array of Strings."
The expected result of this method in the case when there are no
registered writers is not described.
It is intended to be an empty array of Strings
but in fact unexpected IllegalArgumentException is thrown.
(for method without argument).
The same issue occurs for getWriterFormatNames(),
getReaderMIMETypes() and getReaderFormatNames() methods too.
To reproduce the problem run the following test:
---------------------------- source --------------------------------
import javax.imageio.ImageIO;
import javax.imageio.spi.*;
public class Test {
public static void main(String argv[]) {
String[] formatNames;
/* deregister all readers and writers */
IIORegistry CurRegistry = IIORegistry.getDefaultInstance();
CurRegistry.deregisterAll();
try {
formatNames = ImageIO.getWriterMIMETypes();
} catch (Throwable ex) {
System.out.println ("Unexpected exception " + ex.toString());
}
return;
}
}
---------------------------- log --------------------------------
>java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
>java Test
Unexpected exception java.lang.IllegalArgumentException: category unknown!
======================================================================