bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22962] swing: calling JMenu.add twice with same argument


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22962] swing: calling JMenu.add twice with same argument throws ArrayIndexOutOfBoundsException
Date: 16 Oct 2005 01:27:48 -0000

Steps to reproduce:
1. Compile and run the attached testcase.

Expected results:
1. A window shows up. It has "menu0" which contains "menuitem0".

Actual results:
1. No window is shown and the following exception is thrown:
java.lang.ArrayIndexOutOfBoundsException
   at java.lang.VMSystem.arraycopy (Native Method)
   at java.lang.System.arraycopy (System.java:234)
   at java.awt.Container.addImpl (Container.java:370)
   at java.awt.Container.add (Container.java:307)
   at javax.swing.JPopupMenu.insert (JPopupMenu.java:268)
   at javax.swing.JPopupMenu.add (JPopupMenu.java:179)
   at javax.swing.JMenu.add (JMenu.java:153)
   at jmenu.<init> (jmenu.java:14)
   at jmenu.main (jmenu.java:5)

Testcase:
import javax.swing.*;
import java.awt.*;
public class jmenu extends JFrame {
        public static void main(String[] args) {
                (new jmenu()).show();
        }
        public jmenu() {
                JMenuBar mb = new JMenuBar();
                this.setJMenuBar(mb);
                JMenu m = new JMenu("menu0");
                mb.add(m);
                JMenuItem mi = new JMenuItem("menuitem0");
                m.add(mi);
                m.add(mi);
                this.setSize(new Dimension(600, 600));
        }
}


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-06-01 
10:22 -------
I've checked in a fix for that one. Please check and close this bug. Thank you
for reporting.


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-06-01 
13:01 -------
Hmm, I just did "cvs -z2 update -d; make clean; make; make install" but I am
still seeing the same exception.


------- Comment #3 from from-classpath at savannah dot gnu dot org  2005-06-01 
13:30 -------
Sorry, forgot to commit the file. Please try again.


------- Comment #4 from from-classpath at savannah dot gnu dot org  2005-06-01 
16:35 -------
Ok, seems to work now.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22962





reply via email to

[Prev in Thread] Current Thread [Next in Thread]