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

NullPointerException in XMenuPeer.repaintMenuItem

XMLWordPrintable

    • b27
    • generic, x86
    • generic, linux, solaris_2.5.1
    • Verified

      Name: gm110360 Date: 09/24/2004


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


      ADDITIONAL OS VERSION INFORMATION :
      Red Hat Linux Fedora Core 2:
      Linux pingwin 2.6.8-1.521 #1 Mon Aug 16 09:01:18 EDT 2004 i686 i686 i386 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      In specific situations call to java.awt.CheckboxMenuItem.setState() is causing NullPointerException. Here is the exception trace:

      java.lang.NullPointerException
       at sun.awt.X11.XMenuPeer.repaintMenuItem(XMenuPeer.java:360)
       at sun.awt.X11.XCheckboxMenuItemPeer.setState(XCheckboxMenuItemPeer.java:46)
       at java.awt.CheckboxMenuItem.setState(CheckboxMenuItem.java:177)
      ...

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I was not able to create a compact example of the problem. (simple examples worked correctly). The problem can be reproduced running ImageJ (http://rsb.info.nih.gov/ij/), the source code is available at: http://rsb.info.nih.gov/ij/download/src/. I was using version 1.33k Other people reported the same problem with other versions too.

      The problem always happens when trying to open new image after starting the application (File/Open...) or when attempting to show about dialog (Help/About ImageJ...). When both those actions are performed, ImageJ adds an check box item to its Window menu. The exception happens when it tries to set the state of that checkbox item.

      What is interesting, if you try to open the same file over and over again you keep getting the exception. However, if you try to open one file (and get exception) then you open a different file, the other one opens without exception, does not matter what files you open as long they have different names (checkbox menu items also have different labels).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No NullPointerException in call to CheckboxMenuItem.setState()
      ACTUAL -
      See Error Messages below.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception trace while runing ImageJ v.1.33k:

      java.lang.NullPointerException
       at sun.awt.X11.XMenuPeer.repaintMenuItem(XMenuPeer.java:360)
       at sun.awt.X11.XCheckboxMenuItemPeer.setState(XCheckboxMenuItemPeer.java:46)
       at java.awt.CheckboxMenuItem.setState(CheckboxMenuItem.java:177)
       at ij.Menus.updateMenus(Menus.java:817)
       at ij.WindowManager.setCurrentWindow(WindowManager.java:47)
       at ij.WindowManager.addImageWindow(WindowManager.java:146)
       at ij.WindowManager.addWindow(WindowManager.java:136)
       at ij.gui.ImageWindow.<init>(ImageWindow.java:67)
       at ij.gui.ImageWindow.<init>(ImageWindow.java:45)
       at ij.ImagePlus.show(ImagePlus.java:300)
       at ij.ImagePlus.show(ImagePlus.java:281)
       at ij.plugin.AboutBox.run(AboutBox.java:70)
       at ij.IJ.runPlugIn(IJ.java:101)
       at ij.Executer.runPlugIn(Executer.java:170)
       at ij.Executer.runCommand(Executer.java:129)
       at ij.Executer.run(Executer.java:62)
       at java.lang.Thread.run(Thread.java:595)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      http://rsb.info.nih.gov/ij/download/src
      ---------- END SOURCE ----------
      (Incident Review ID: 311463)
      ======================================================================

            vbaranovsunw Vyacheslav Baranov (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: