Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4936498

SPEC: incorrect default type for BMPImageWriteParam.getCompressionType()

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b36
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      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
      %

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

        Attachments

          Activity

            People

            Assignee:
            bae Andrew Brygin
            Reporter:
            vivsunw Viv Viv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: