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

NPE in javax.imageio.stream.FileCacheImageOutputStream.close()

XMLWordPrintable

      FULL PRODUCT VERSION :
      C:\Users\pebl>java -version
      java version "1.8.0_72"
      Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      While developing/testing a program, that among other things create images, I had a bug that caused a throwing runtimeexception.
      However I also got the following NPE:

      Exception in thread "Thread-43" java.lang.NullPointerException
      at javax.imageio.stream.FileCacheImageOutputStream.close(FileCacheImageOutputStream.java:229)
      at com.sun.imageio.stream.StreamCloser$CloseAction.performAction(StreamCloser.java:130)
      at com.sun.imageio.stream.StreamCloser$1.run(StreamCloser.java:74)
      at java.lang.Thread.run(Thread.java:745)

      I have searched for such bug and I found a 5 year old bug+patch:
      http://mail.openjdk.java.net/pipermail/2d-dev/2012-June/002567.html

      Looking at the source tells that at least in my java version that I probably hit the same npe.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This seems like a racy between a throwing a runtimeexception and creating a image in another thread.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Not expecting a NPE.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "Thread-43" java.lang.NullPointerException
      at javax.imageio.stream.FileCacheImageOutputStream.close(FileCacheImageOutputStream.java:229)
      at com.sun.imageio.stream.StreamCloser$CloseAction.performAction(StreamCloser.java:130)
      at com.sun.imageio.stream.StreamCloser$1.run(StreamCloser.java:74)
      at java.lang.Thread.run(Thread.java:745)

      REPRODUCIBILITY :
      This bug can be reproduced rarely.

            jdv Jayathirth D V
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: