JDK-6339169 : ImageReader.read() triggers JNI warning messages
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-10-19
  • Updated: 2010-04-02
  • Resolved: 2005-10-19
Related Reports
Duplicate :  
Description
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 ----------

Comments
EVALUATION This is a duplicate of 4528643.
19-10-2005