-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.5
-
sparc
-
solaris_2.6
Appletviewer core dumps while disposing modal dialogs on Solaris 2.6/Sparc machines, if LC_CTYPE is set to en_US.
I used a simple applet, which brings up a modal dialog on a button-click and
disposes the dialog on a button-click on the dialog. When environment variable
LC_CTYPE was set to en_US - the applet core dumps almost every time I try to
dispose the dialog. After unsetting LC_CTYPE, the applet did not core dump for
about 20 create/dispose dialog attempts. I did not continue the test after that.
Following is the code for test applet -
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class DialogTest extends Applet implements ActionListener {
String text;
String buttonLabel;
Frame appletFrame;
TestDialog dialog;
public DialogTest() {
text = "Click on the button to bring up a Dialog Box";
buttonLabel = "Dialog...";
}
public void init() {
this.setLayout(new BorderLayout());
this.add("Center", new MyPanel(this, text, buttonLabel));
if (appletFrame == null) {
Component parent = this;
while (true) {
if (parent == null) {
System.exit(1);
} else if (parent instanceof Frame) {
break;
} else {
parent = parent.getParent();
}
}
appletFrame = (Frame)parent;
}
}
public static void main(String[] args) {
Frame f = new Frame("Dialog Test");
DialogTest d = new DialogTest();
d.appletFrame = f;
d.init();
f.add(d);
f.pack();
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
dialog = new TestDialog(appletFrame);
dialog.setVisible(true);
}
class TestDialog extends Dialog implements ActionListener {
String text;
String buttonLabel;
public TestDialog(Frame f) {
super(f, "Dialog", true);
text = "Click on the button to bring down the Dialog Box";
buttonLabel = "Close";
this.add("Center", new MyPanel(this, text, buttonLabel));
this.pack();
}
public void actionPerformed(ActionEvent e) {
this.setVisible(false);
this.dispose();
}
}
class MyPanel extends Panel {
Button btDialog;
TextArea taMsg;
public MyPanel(ActionListener action, String tMsg, String bMsg) {
this.setLayout(new BorderLayout());
Button b = new Button(bMsg);
b.addActionListener(action);
TextArea a = new TextArea();
a.setEditable(false);
a.append(tMsg);
this.add("Center", a);
this.add("South", b);
}
}
}
I used a simple applet, which brings up a modal dialog on a button-click and
disposes the dialog on a button-click on the dialog. When environment variable
LC_CTYPE was set to en_US - the applet core dumps almost every time I try to
dispose the dialog. After unsetting LC_CTYPE, the applet did not core dump for
about 20 create/dispose dialog attempts. I did not continue the test after that.
Following is the code for test applet -
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class DialogTest extends Applet implements ActionListener {
String text;
String buttonLabel;
Frame appletFrame;
TestDialog dialog;
public DialogTest() {
text = "Click on the button to bring up a Dialog Box";
buttonLabel = "Dialog...";
}
public void init() {
this.setLayout(new BorderLayout());
this.add("Center", new MyPanel(this, text, buttonLabel));
if (appletFrame == null) {
Component parent = this;
while (true) {
if (parent == null) {
System.exit(1);
} else if (parent instanceof Frame) {
break;
} else {
parent = parent.getParent();
}
}
appletFrame = (Frame)parent;
}
}
public static void main(String[] args) {
Frame f = new Frame("Dialog Test");
DialogTest d = new DialogTest();
d.appletFrame = f;
d.init();
f.add(d);
f.pack();
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
dialog = new TestDialog(appletFrame);
dialog.setVisible(true);
}
class TestDialog extends Dialog implements ActionListener {
String text;
String buttonLabel;
public TestDialog(Frame f) {
super(f, "Dialog", true);
text = "Click on the button to bring down the Dialog Box";
buttonLabel = "Close";
this.add("Center", new MyPanel(this, text, buttonLabel));
this.pack();
}
public void actionPerformed(ActionEvent e) {
this.setVisible(false);
this.dispose();
}
}
class MyPanel extends Panel {
Button btDialog;
TextArea taMsg;
public MyPanel(ActionListener action, String tMsg, String bMsg) {
this.setLayout(new BorderLayout());
Button b = new Button(bMsg);
b.addActionListener(action);
TextArea a = new TextArea();
a.setEditable(false);
a.append(tMsg);
this.add("Center", a);
this.add("South", b);
}
}
}