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

ImageReader.read() triggers JNI warning messages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.5.0_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]
      Service Pack2

      A DESCRIPTION OF THE PROBLEM :
      Execute the testcase using -Xcheck:jni. Applications making use of ImageIO get these warnings very frequently which makes it harder to debug their own JNI issues (it is difficult to separate JDK-caused warnings from user-code caused warnings).


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      >java -Xcheck:jni Testcase
      Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCr
      itical or Get/ReleaseStringCritical
      Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCr
      itical or Get/ReleaseStringCritical

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.image.BufferedImage;
      import java.io.FileInputStream;
      import java.util.Iterator;
      import javax.imageio.ImageIO;
      import javax.imageio.ImageReader;
      import javax.imageio.stream.ImageInputStream;

      public class Testcase
      {
        public static void main(String[] args)
        {
          try
          {
            Iterator<ImageReader> readers = ImageIO.getImageReadersByMIMEType("image/jpeg");
            ImageReader reader = readers.next();
            
            ImageInputStream in = ImageIO.createImageInputStream(new FileInputStream("filename.jpg"));
            reader.setInput(in);
            
            // The following line outputs "Warning: Calling other JNI functions in
            // the scope of Get/ReleasePrimitiveArrayCritical or
            // Get/ReleaseStringCritical" twice
            BufferedImage image = reader.read(reader.getMinIndex());
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: