ImageReader-s returned from ImageIO.getImageReaders() doesn't follow spec

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 5.0
    • Component/s: client-libs
    • None

      ImageReader instances returned by ImageIO.getImageReaders() don't correctly follow spec for the following methods: getAspectRatio(), getRawImageType().

      There are problems with throwing of IndexOutOfBoundsException from these methods.
      1) javax.imageio.PNGImageReader.getAspectRatio() doesn't throw IndexOutOfBoundsException for incorrect index
      Please find in the attachment the file GetAspectRatioTest.java to verify this behavior.
      Output is following:
      ImageReader: javax.imageio.PNGImageReader@a440b9
      Num of Images: 1
      getAspectRatio(0) = 1.0294118
      getAspectRatio(-2147483648) didn't throw IndexOutOfBoundsException
      getAspectRatio(-2147483648) = 1.0294118
      getAspectRatio(-1) didn't throw IndexOutOfBoundsException
      getAspectRatio(-1) = 1.0294118
      getAspectRatio(10) didn't throw IndexOutOfBoundsException
      getAspectRatio(10) = 1.0294118
      getAspectRatio(2147483647) didn't throw IndexOutOfBoundsException
      getAspectRatio(2147483647) = 1.0294118
      Failed

      2) javax.imageio.JPEGImageReader.getRawImageType() doesn't throw IndexOutOfBoundsException for index = -1.
      Please find in the attachment corresponding example GetRawImageTypeTest.java.
      Output is:
      ImageReader: javax.imageio.JPEGImageReader@c3e31
      getMinIndex() = 0
      getRawImageType(-2147483648): OK
      getRawImageType(-1) didn't throw IndexOutOfBoundsException
      getRawImageType(-1) = null
      getRawImageType(10): OK
      getRawImageType(2147483647): OK
      Failed

            Assignee:
            Andrew Brygin
            Reporter:
            Alexander Glasman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: