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

ClassCastException when adding IFD to the TIFFDirectory before the image write

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • client-libs

    Description

      Please run the attached code. The following exception will occur:

      Exception in thread "main" java.lang.ClassCastException: javax.imageio.plugins.tiff.TIFFDirectory (in module: java.desktop) cannot be cast to com.sun.imageio.plugins.tiff.TIFFIFD (in module: java.desktop)
      at com.sun.imageio.plugins.tiff.TIFFImageWriter.setupMetadata(java.desktop@9-ea/TIFFImageWriter.java:1479)
      at com.sun.imageio.plugins.tiff.TIFFImageWriter.write(java.desktop@9-ea/TIFFImageWriter.java:2501)
      at com.sun.imageio.plugins.tiff.TIFFImageWriter.write(java.desktop@9-ea/TIFFImageWriter.java:2313)
      at javax.imageio.ImageWriter.write(java.desktop@9-ea/ImageWriter.java:595)
      at IFDTest.writeImage(IFDTest.java:54)
      at IFDTest.main(IFDTest.java:64)

      JDK9 b111, Windows 7

      The cast in TIFFImageWriter is
        exifIFD = (TIFFIFD)f.getDirectory();
      (and there are some other similar casts in the sources which should probably be checked).


      The same issue for GPS IFD (tag #34853)

      Attachments

        Activity

          People

            bpb Brian Burkhalter
            avstepan Alexander Stepanov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: