JDK-4403925 : JOptionPane internal dialog causes applet to deadlock when page switching
  • Type: Bug
  • Component: deploy
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-01-11
  • Updated: 2017-10-06
  • Resolved: 2017-07-27
Related Reports
Relates :  
Relates :  
Relates :  
Description

Name: yyT116575			Date: 01/11/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


Make the content pane of a JApplet a JDesktopPane. Next show a JOptionPane
internal message on the desktop pane. If the user page switches to another
applet or reloads the existing applet while the JOptionPane is showing the
message the applet and browser both hang. If the user clears the dialog first
and then page switches, no problem occurs. I have attached a sample applet
below that you can use to duplicate the problem.

I wonder if somehow the event queue created to show the option pane isn't still
getting the events for the new applet. Does the plug-in reinitialize the VM on
page switches or does it continue to use the existing event thread?

package com.workbrain.swingtest;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;

public class TestApplet extends JApplet {
    boolean isStandalone = false;
    /**Get a parameter value*/
    public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
            (getParameter(key) != null ? getParameter(key) : def);
    }

    /**Construct the applet*/
    public TestApplet() {
    }
    /**Initialize the applet*/
    public void init() {
        try {
            jbInit();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
    /**Component initialization*/
    private void jbInit() throws Exception {
        JDesktopPane content=new JDesktopPane();
        this.setContentPane(content);
        this.setSize(new Dimension(400,300));
        content.setSize(new Dimension(400,300));
        JMenuBar menuBar=new JMenuBar();
        JMenu file=new JMenu("File");
        JMenuItem show=new JMenuItem("Show");
        show.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JOptionPane.showInternalMessageDialog(TestApplet.this.getContentPane(),"This is a test");
                System.out.println("Hello");
            }
        });
        menuBar.add(file);
        file.add(show);
        this.setJMenuBar(menuBar);
    }
    /**Get Applet information*/
    public String getAppletInfo() {
        return "Applet Information";
    }
    /**Get parameter info*/
    public String[][] getParameterInfo() {
        return null;
    }

    //static initializer for setting look & feel
    static {
        try {
            //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            //UIManager.setLookAndFeel
            (UIManager.getCrossPlatformLookAndFeelClassName());
        }
        catch(Exception e) {
        }
    }
}
(Review ID: 114722) 
======================================================================

Comments
posted testcase at: http://oklahoma.us.oracle.com/www/tests/javapi/generic/jop/applet.html I cannot reproduce with any modern browser/java combinations. closing as Cannot Reproduce
27-07-2017

EVALUATION Appletviewer also deadlocks if I do the following a) Run the appletviewer with appropriate .html file to load the sample applet. b) Select 'Show' from the menu 'File'. c) Without closing the dialog box, try to reload the applet. It hangs now. devananda.jayaraman@Eng 2001-01-29 AppletPanel is doing a join to attach back to the thread it created. The problem with doing a join is that you never know what state the applet is in, and thus if the threads can be joined. I think appletviewer needs to be more aggressive here, and kill all the threads in the thread group and create a new one. scott.violet@eng 2001-04-05
05-04-2001