-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.2
-
sparc
-
solaris_2.5.1
Name: aaC67449 Date: 12/22/98
JMenu.removeAll() throws unexpected NullPointerException, when popupMenu is not initialized.
See example.
One line should be added to the code to fix this bug
JMenu.java:713:
public void removeAll() {
if(popupMenu!=null) { // <--- test popupMenu is initialized
popupMenu.removeAll();
}
clearListenerRegistry();
}
--------------- Example---------------------------
import javax.swing.*;
public class Test{
public static void main(String argv[]) {
JMenu c = new JMenu(); // Create JMenu object
c.removeAll();
}
}
----------------output------------------
Exception in thread "main" java.lang.NullPointerException
at javax.swing.JMenu.removeAll(Compiled Code)
at Test.main(Compiled Code)
======================================================================
- duplicates
-
JDK-4197752 JMenu.removeAll() (Swing 1.1) doesn't work.
-
- Resolved
-