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

ImageReadParam.setDestination(wrong) results in assortment of failures

XMLWordPrintable

      We have a 2D negative test written by Praveen M. some time in 2003. The test does invoke ImageReadParam.setDestination() passing there various incompatible formats. The method specification claims there should be IIOException on an attempt to read.

      It never did work that way but with time, the variety of different exceptions thrown became truly entertaining. It's
      java.lang.IndexOutOfBoundsException: off < 0 || len < 0 || off + len > b.length!
      java.lang.NullPointerException
      java.lang.ClassCastException: java.awt.image.SinglePixelPackedSampleModel (in module: java.desktop) cannot be cast to java.awt.image.MultiPixelPackedSampleModel
      java.lang.ClassCastException: java.awt.image.PixelInterleavedSampleModel (in module: java.desktop) cannot be cast to java.awt.image.MultiPixelPackedSampleModel
      java.lang.IllegalArgumentException: ImageReadParam num source & dest bands differ!
      java.lang.ClassCastException: [B (in module: java.base) cannot be cast to [S
      java.lang.ArrayIndexOutOfBoundsException: 85
      java.lang.ClassCastException: [B (in module: java.base) cannot be cast to [I

            jdv Jayathirth D V
            yan Yuri Nesterenko
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: