-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3_01
-
sparc
-
solaris_7
Name: jm25052 Date: 06/29/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-beta)
Java HotSpot(TM) Client VM (build 1.3-beta, mixed mode)
There is a VERY serious bug in Sun's JDK involving the use of buttons that have
disabled images. The bug results in the entire JVM hanging, requiring that the
application be killed externally. It only appears to be a problem when
the OS is configured to use multiple CPUs. This has been reported against 1.2.2
as well as bug id 4332685, but the fix appears to have not made it into the
beta. The hang does not occur on every invocation, but typically on 3 out of 5.
To run the testcase, compile the code below, then invoke. After the window appea
rs click on the "Test" menubar button. If the menu pops down the the bug
didn't occur so exit and try again. If the menu doesn't
pop down then BINGO! you've just seen the hang. You'll have to kill the VM
process manually to getit to quit.
Note that if you invoke the testcase with a command-line argument the images in
the menu will not be disabled. This allows you to run the testcase and not have
to worry about the bug because the images in the menu won't be disabled.
Test case uses 5 gif's cut.gif, copy.gif, open.gif, save.gif, and paste.gif.
These are aval in the 1.2.2 releases and the NT 1.3 release in
jdk1.3rc2/demo/jfc/Notepad/resources.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DisabledImageHang extends JFrame {
// ###
// ### UPDATE THE FOLLOWING PATH FOR YOUR SYSTEM
// ###
static final String IMAGES = "d:/jdk1.3rc2/demo/jfc/Notepad/resources/";
static final String[] NAMES =
{"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public DisabledImageHang(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
//menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
menuItem.setIcon(new ImageIcon(NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
DisabledImageHang window = new
DisabledImageHang((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
window.setBounds(300, 300, 400, 400);
window.setVisible(true);
}
}
(Review ID: 106594)
======================================================================
- duplicates
-
JDK-4332685 AbstractButton.getDisabledIcon can cause the VM to hang! (dual-processor box)
-
- Closed
-