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

getCompressionTypes() does not throw UnsupportedOperationException

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: vrR10176 Date: 04/17/2001



      Api spec (jdk1.4.0beta-b59) says about method
      javax.imageio.ImageWriteParam.getCompressionTypes():
      "public String[] getCompressionTypes()
        Returns a list of available compression types, as an array or Strings, or null if a
        compression type may not be chosen using these interfaces. The array returned is a copy.
      ...
      Throws:
      UnsupportedOperationException - if the writer does not support compression."

      But the method does not throw UnsupportedOperationException when the writer does
      not support compression.

      This bug causes failure of new JCK test:
      api/javax_imageio/ImageWriteParam/index.html#getCompressionTypes

      To reproduce the issue execute following test.
      ------------------------ test.java ------------------------
      import javax.imageio.ImageWriteParam;

      public class test {

      public static void main(String[] argv) {
      ImageWriteParam imagewriteparam = new ImageWriteParam(null);
      try{
      System.out.println("canWriteCompressed() returns " + imagewriteparam.canWriteCompressed());
      imagewriteparam.getCompressionTypes();
      System.out.println("Test failed. UnsupportedOperationException was expected");
      } catch (UnsupportedOperationException e) {
      System.out.println("Test passed");
      }
      }
      }
      ------------ Logs ------------------------------------------
      $ java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b60)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b60, mixed mode)

      $ javac test.java

      $ java test
      canWriteCompressed() returns false
      Test failed. UnsupportedOperationException was expected

      -----------------------------------------------

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

        Attachments

          Activity

            People

            Assignee:
            dricesunw Daniel Rice (Inactive)
            Reporter:
            rslasunw Rsla Rsla (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: