-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
b36
-
generic
-
generic
-
Verified
Name: viR10068 Date: 10/13/2003
The API spec for jdk 1.5.0-b23 say for the class BMPImageWriteParam:
"By default, no compression is used (the compression type is "BI_RGB")".
But the methods getCompressionType() return 'null' as default value.
The example:
-------------------------- test.java ----------------------------
import java.io.PrintStream;
import javax.imageio.ImageWriteParam;
import javax.imageio.plugins.bmp.BMPImageWriteParam;
class test {
public static void main(String argv[]) {
BMPImageWriteParam biwp = new BMPImageWriteParam();
if (setModeExpl(biwp) != 0) {
System.out.println("Unexpected exception");
return;
}
if(!"BI_RGB".equals(biwp.getCompressionType())) {
System.out.println("FAILED. Incorrect default value for CompressionType: " +
biwp.getCompressionType());
return;
}
System.out.println("OKAY");
}
private static int setModeExpl(BMPImageWriteParam biwp) {
try {
if (biwp.getCompressionMode() != ImageWriteParam.MODE_EXPLICIT) {
biwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
}
} catch (RuntimeException re) {
System.out.println("Unexpected exception: " + re);
return -1;
}
return 0;
}
}
-----------------------------------------------------------------
The execution log:
% jdk1.5.0-b23/solaris-sparc/bin/javac test.java && jdk1.5.0-b23/solaris-sparc/bin/java
-showversion -Xfuture test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b23)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b23, mixed mode)
FAILED. Incorrect default value for CompressionType: null
%
======================================================================