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

setTiling() may throw unspecified exception

    XMLWordPrintable

    Details

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

      Description



      Name: vrR10176 Date: 04/05/2001



      Api spec (jdk1.4.0beta-b58) says about field
      javax.imageio.ImageWriteParam.preferredTileSizes:

      "protected Dimension[] preferredTileSizes
        An array of preferred tile sizes. The default value is null,
      which indicates that there are no preferred sizes.
        ImageWriters that do not support writing tiles may ignore this value."

      This description does not say that Dimension array should
      be a set of pairs. Therefore subclasses may assign to field
      preferredTileSizes an array of length 1. But in this case
      the method javax.imageio.ImageWriteParam.setTiling() throws
      unspecified ArrayIndexOutOfBoundsException.

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

      public class myImageWriteParam extends ImageWriteParam {

      public myImageWriteParam() {
      super(null);
      super.canWriteTiles = true;
      super.preferredTileSizes = new Dimension[]{new Dimension(1,2)};
      }

      public static void main(String[] argv) {
      myImageWriteParam myimagewriteparam = new myImageWriteParam();
      myimagewriteparam.setTilingMode(ImageWriteParam.MODE_EXPLICIT);
      myimagewriteparam.setTiling(0,0,0,0);
      System.out.println("Test passed");
      }
      }
      ------------ Logs ------------------------------------------
      $ javac myImageWriteParam.java

      $ java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b58)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b58, mixed mode)

      $ java myImageWriteParam
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
              at javax.imageio.ImageWriteParam.setTiling(ImageWriteParam.java:585)
              at myImageWriteParam.main(myImageWriteParam.java:15)

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

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

        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: