-
Bug
-
Resolution: Fixed
-
P2
-
7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2181172 | 6u18 | Vikram Aroskar | P2 | Closed | Fixed | b02 |
JDK-2184216 | 6u17-rev | Vikram Aroskar | P2 | Resolved | Fixed | b05 |
JDK-2182769 | 6u16-rev | Vikram Aroskar | P2 | Closed | Fixed | b04 |
Run the test, you will see two frames and one modal dialog, close the dialog, NPE occured.
Also you may noticed that second frame may be moved above modal dialog.
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class npe_test {
public static void main(String[] args)
{
Frame frame1 = new Frame("frame 1");
frame1.setBounds(0, 0, 100, 100);
frame1.setVisible(true);
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
Frame frame2 = new Frame("frame 2");
frame2.setBounds(150, 0, 100, 100);
frame2.setVisible(true);
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
Frame frame3 = new Frame("frame 3");
Dialog dialog = new Dialog(frame3, "dialog", true);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
we.getWindow().dispose();
}
});
dialog.setBounds(300, 0, 100, 100);
dialog.setVisible(true);
frame1.dispose();
frame2.dispose();
frame3.dispose();
}
}
Also you may noticed that second frame may be moved above modal dialog.
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class npe_test {
public static void main(String[] args)
{
Frame frame1 = new Frame("frame 1");
frame1.setBounds(0, 0, 100, 100);
frame1.setVisible(true);
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
Frame frame2 = new Frame("frame 2");
frame2.setBounds(150, 0, 100, 100);
frame2.setVisible(true);
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
Frame frame3 = new Frame("frame 3");
Dialog dialog = new Dialog(frame3, "dialog", true);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
we.getWindow().dispose();
}
});
dialog.setBounds(300, 0, 100, 100);
dialog.setVisible(true);
frame1.dispose();
frame2.dispose();
frame3.dispose();
}
}
- backported by
-
JDK-2184216 NPE when closing modal dialog
- Resolved
-
JDK-2181172 NPE when closing modal dialog
- Closed
-
JDK-2182769 NPE when closing modal dialog
- Closed
- relates to
-
JDK-6518077 Modal dialogs open slowly with JRE 1.6.0 sun.awt.X11.XToolkit
- Closed