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

Java program dumps core at start up for a menu bar demo program

XMLWordPrintable

    • 1.1.6
    • x86
    • solaris_2.6
    • Verified



        Name: paC48320 Date: 11/13/97


        Platform: Sun Ultra 1 running Solaris 2.5
        Java JDK used: JDK1.1.5D

        1. Execute the java program, "MenuBarBug"
        2. Source code, as follows:
        /*
         * MenuBarBug.java
         * Test program to reproduce MenuBarBug.
         * Bug Description
         * Setting a menubar as a Frame MenuBar and removing it before the
         * frame is realized and then setting it again after the Frame is
         * realized causes a null-pointer exception.
         * Running the test
         * - Compile and run MenuBarBug.java
         * - You will see a Frame with an empty menubar and a pushbutton
         * - Press the pushbutton
         * - You will see a null-pointer exception at this point
         * @author Sridhar Reddy (###@###.###)
         */
        import java.awt.Frame;
        import java.awt.MenuBar;
        import java.awt.Button;
        import java.awt.event.ActionEvent;
        import java.awt.event.ActionListener;
        public class MenuBarBug extends Frame implements ActionListener
        {
          // constructor
          public MenuBarBug()
          {
            super("MenuBarBug");
            // create menubars
            menubar1 = new MenuBar();
            menubar2 = new MenuBar();
            // set menubar1 as the Frame's MenuBar and replace it with
            // menubar2
            setMenuBar(menubar1);
            setMenuBar(menubar2);
            // create a button to change menubar back to menubar1
            button = new Button("Change MenuBar");
            add(button);
            button.addActionListener(this);
            setSize(200, 200);
          }
          // ActionListener implementation
          public void actionPerformed(ActionEvent e)
          {
            // set the menubar back to MenuBar
            setMenuBar(menubar1);
          }
          // instance variables
          MenuBar menubar1;
          MenuBar menubar2;
          Button button;
          // test main
          public static void main(String[] args)
          {
            MenuBarBug window = new MenuBarBug();
            window.setVisible(true);
          }
        }

        3. Program dumps core. Message follows:
        SIGSEGV 11* segmentation violation
            si_signo [11]: SIGSEGV 11* segmentation violation
            si_errno [0]: Error 0
            si_code [1]: SEGV_MAPERR [addr: 0x0]

                stackbase=EFFFE900, stackpointer=EFFFE640

        Full thread dump:
            "AWT-Motif" (TID:0xee704f48, sys_thread_t:0xedfb1db8, state:R) prio=5
            "AWT-Input" (TID:0xee704f68, sys_thread_t:0xedfe1db8, state:R) prio=5
            "AWT-EventQueue-0" (TID:0xee704f80, sys_thread_t:0xee011db8, state:R) prio=5
            "Finalizer thread" (TID:0xee703c48, sys_thread_t:0xee2c1db8, state:R) prio=1
            "Async Garbage Collector" (TID:0xee703c90, sys_thread_t:0xee2f1db8, state:R) prio=1
            "Idle thread" (TID:0xee703a08, sys_thread_t:0xee3c1db8, state:R) prio=0
            "Clock" (TID:0xee700088, sys_thread_t:0xee3f1db8, state:CW) prio=12
            "main" (TID:0xee7000b0, sys_thread_t:0x685f8, state:R) prio=5 *current thread*
                sun.awt.motif.MFramePeer.setMenuBar(MFramePeer.java:112)
                java.awt.Frame.addNotify(Frame.java:205)
                java.awt.Window.show(Window.java:144)
                java.awt.Component.show(Component.java:498)
                java.awt.Component.setVisible(Component.java:460)
                MenuBarBug.main(MenuBarBug.java:43)
        Monitor Cache Dump:
            sun.awt.motif.MToolkit@EE704D48/EE75F138: owner "main" (0x685f8, 1 entry)
        Registered Monitor Dump:
            Thread queue lock: <unowned>
            Name and type hash table lock: <unowned>
            String intern lock: <unowned>
            JNI pinning lock: <unowned>
            JNI global reference lock: <unowned>
            BinClass lock: <unowned>
            Class loading lock: <unowned>
            Java stack lock: <unowned>
            Code rewrite lock: <unowned>
            Heap lock: <unowned>
            Has finalization queue lock: <unowned>
            Finalize me queue lock: <unowned>
            Monitor IO lock: <unowned>
            Child death monitor: <unowned>
            Event monitor: <unowned>
            I/O monitor: <unowned>
            Alarm monitor: <unowned>
                Waiting to be notified:
                    "Clock"
            Sbrk lock: <unowned>
            Monitor cache expansion lock: <unowned>
            Monitor registry: owner "main" (0x685f8, 1 entry)
        Thread Alarm Q:
        Abort (core dumped)

        4. See above
        5. N/A.
        (Review ID: 19597)
        ======================================================================

              duke J. Duke
              pallenba Peter Allenbach (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: