JDK-4936498 : SPEC: incorrect default type for BMPImageWriteParam.getCompressionType()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2003-10-13
  • Updated: 2017-05-16
  • Resolved: 2004-01-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b36Fixed
Description

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
% 

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta tiger-beta2 INTEGRATED IN: tiger-b36 tiger-beta2 VERIFIED IN: tiger-beta2
21-08-2004

EVALUATION Need to update the javadoc. ###@###.### 2003-10-23
23-10-2003