JDK-4170640 : Modal dialogs do not properly block
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.6
  • Priority: P1
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris_2.6
  • CPU: generic
  • Submitted: 1998-09-01
  • Updated: 1998-09-02
  • Resolved: 1998-09-02
Related Reports
Relates :  
Description
tushar.patel@West 1998-09-01
Opening a new bug, based on discussion with xianfa.deng@Eng. This bug
may be similar to Bug # 4124096 .

Also note, there is an escalation to get fix/patch for this problem,
Esc # 516395.

For more detail, pl refer to Comments section:

Here is some code that fails under native and runs under green threads,
i.e. modal dialogs do not work, under JDK 1.1.6, no Swing used.
I adapted it from the bug report 4124096.
Also included is the run script I used.


/*
 * ModalDialogTest.java
 * Dialog created with modality parameter set to true is not modal on
 * Solaris
 *
 */

import java.awt.*;
import java.awt.event.*;

public class ModalDialogTest extends Panel implements ActionListener {
    Dialog dialog = new Dialog(new Frame(), "Modal Dialog", true);

    public static void main( String[] argv ) {
        new ModalDialogTest();
    }

    public ModalDialogTest() {
    Frame frame = new Frame("Modal Dialog Test");
    Panel controlPanel = new Panel();
    Panel infoPanel = new Panel();
    Button showButton = new Button("Show Modal Dialog");
    Button testButton = new Button("Test");

    frame.setLayout(new BorderLayout());
    infoPanel.setLayout(new GridLayout(0,1));
//    showButton.setOpaque(true);
    showButton.setBackground(Color.yellow);
//    testButton.setOpaque(true);
    testButton.setBackground(Color.pink);
    controlPanel.add(showButton);
    controlPanel.add(testButton);
    infoPanel.add(new Label("Click the \"Show Modal Dialog\" button to display
a modal Dialog."));
    infoPanel.add(new Label("Click the \"Test\" button to verify dialog
modality."));
    frame.add(BorderLayout.NORTH, controlPanel);
    frame.add(BorderLayout.SOUTH, infoPanel);
    dialog.setSize(200,200);

    showButton.addActionListener(this);
    testButton.addActionListener(this);

    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}
    public void windowClosed(WindowEvent e) {System.exit(0);}
    });

    frame.pack();
    frame.setSize(450, 120);
    frame.setVisible(true);
                      }

    public void actionPerformed(ActionEvent evt) {
        String command = evt.getActionCommand();

        if (command == "Show Modal Dialog") {
             System.out.println("*** Invoking JDialog.show() ***");
             dialog.setLocation(200,200);
             dialog.show();
        }
        else if (command == "Test") {
             System.out.println("*** Test ***");
        }
    }
}



run script:


#!/bin/ksh


unset CLASSPATH
unset LD_LIBRARY_PATH
unset JAVA_HOME

export THREADS_TYPE=${THREADS_FLAG:-native}_threads

#PROG=$(basename $0)
ARCH=$(uname -p)

case $1 in
-native)
    THREADS_TYPE=native_threads
    shift
    ;;
-green)
    THREADS_TYPE=green_threads
    shift
    ;;
esac

if [ -z "$JAVA_HOME" ]
then
    export JAVA_HOME=$M1HOME/vod/jre
fi

if [ -z "$CLASSPATH" ]
then
    if [[ $THREADS_TYPE = "native_threads" ]]
    then
        export CLASSPATH=$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/i18n.jar:.
        CLASSPATH=$JAVA_HOME/lib/classes.zip:$CLASSPATH
        echo "Native threads"
    else
        export CLASSPATH=$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/i18n.jar:.
        echo "Green threads"
    fi
fi

export LD_LIBRARY_PATH=$JAVA_HOME/lib/$ARCH/$THREADS_TYPE

# java interpreter options:
# -ms16m set heap starting size to 16 Mbytes

exec $JAVA_HOME/bin/$ARCH/$THREADS_TYPE/jre -ms16m ModalDialogTest



You will have to change JAVA_HOME to run the script.


-- 
===============


Comments
EVALUATION I downloaded the newest production version Solaris_JRE_1.1.6_03. I noticed it only has native threads, while the version I downloaded in April only had green threads. From "Andy Modla" <###@###.###>: Anyway you will all be glad to hear that the LAI application runs correctly with modal dialogs with this newest version of JRE 1.1.6 (native threads). The test case also works. (Note: the test case crashes on start up with a segmentation violation when I run it on a Sun remotely using rsh, from an IRIX computer, but works fine when run on the Sun machine directly. Our LAI application does not crash using rsh from an IRIX computer) Based on that, this bug is now closed. xianfa.deng@Eng 1998-09-02
02-09-1998