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

Bad global or local ref passed to JNI with Java6u12 when -Xcheck:jni

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 6u12
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When running our application with the -Xcheck:jni VM flag, we get:
      FATAL ERROR in native method: Bad global or local ref passed to JNI
              at sun.awt.windows.WToolkit.eventLoop(Native Method)
              at sun.awt.windows.WToolkit.run(WToolkit.java:291)
              at java.lang.Thread.run(Thread.java:619)
      whenever a dialog box is disposed

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the test case code with the -Xcheck:jni VM flag, click on the button and the exception should be produced


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      FATAL ERROR in native method: Bad global or local ref passed to JNI
              at sun.awt.windows.WToolkit.eventLoop(Native Method)
              at sun.awt.windows.WToolkit.run(WToolkit.java:291)
              at java.lang.Thread.run(Thread.java:619)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package javaapplication1;

      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import javax.swing.JButton;
      import javax.swing.JDialog;

      // run with -Xcheck:jni flag
      public class Main
      {
        public static void main(String[] args)
        {
            final JDialog dlg = new JDialog();
            JButton btn = new JButton("Hit me!");
            btn.addActionListener(new ActionListener()
            {
              public void actionPerformed(ActionEvent e)
              {
                dlg.dispose();
              }
            });
            dlg.getContentPane().add(btn);
            dlg.pack();
            dlg.setModal(true);
            dlg.setVisible(true);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Stopped using the -Xcheck:jni flag

      Release Regression From : 6u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: