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

GIF Writer throws NPE when writing a buffered image created through GC.createCompatibleImage()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • client-libs

      I am creating a buffered image from the default GraphicsConfiguration by calling GC.createCompatibleImage(). I am rendering some 2D shapes into the buffered image and trying to write this buffered image to a file using GIF Writer, using the default Image Metadata. GIFWriter.writeToSequence() throws a NullPointerException as follows:

      java.lang.NullPointerException
      at com.sun.imageio.plugins.common.PaletteBuilder.findPaletteEntry(PaletteBuilder.java:310)
      at com.sun.imageio.plugins.common.PaletteBuilder.getIndexColorModel(PaletteBuilder.java:296)
      at com.sun.imageio.plugins.common.PaletteBuilder.getIndexedImage(PaletteBuilder.java:145)
      at com.sun.imageio.plugins.common.PaletteBuilder.createIndexedImage(PaletteBuilder.java:77)
      at com.sun.imageio.plugins.gif.GIFImageWriter.write(GIFImageWriter.java:573)
      at com.sun.imageio.plugins.gif.GIFImageWriter.writeToSequence(GIFImageWriter.java:521)
      at GIFCreateImageTest.createAnimatedImage(GIFCreateImageTest.java:142)
      at GIFCreateImageTest.<init>(GIFCreateImageTest.java:65)
      at GIFCreateImageTest.main(GIFCreateImageTest.java:180)

      This is reproducible on all platforms with Mustang-b43.

      I have attached a sample test. Execute the sample test. YOu would see the above exception on the console.

            bae Andrew Brygin
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: