JDK-4404107 : JOptionPane.showInternal*Dialog() throws AppletSecurityException
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_98
  • CPU: x86
  • Submitted: 2001-01-12
  • Updated: 2001-03-15
  • Resolved: 2001-03-15
Related Reports
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)

I am using a variety of JInternalFrame objects inside an applet to clone an
existing DOS-based interface. The internal frames all have a class that extends
JDesktopPane as their immediate parent. The frames typically enclose JPanels
with various JTextField input fields on them and buttons like "ok", "clear" and
"cancel". The data from the JTextFields is stored in an object representing the
data when "ok" is clicked on, following a data-validation check. I would like to
call JOptionPane.showInternalMessageDialog(thePanel, message, title,
JOptionPane.WARNING_MESSAGE) if the data validation fails on any JPanel 'form'.
However, I am finding that such a call causes a
netscape.security.AppletSecurityException: checkawteventqueueaccess to be
thrown.

On the other hand, using the JOptionPane.showMessageDialog() method rather than
the showInternal*** (with otherwise identical code) causes no problem at all. I
haven't seen a reference to this problem in particular, although I did read that
it used to be necessary to employ a workaround to prevent awt event queue access
generating an AppletSecurityException for JInternalPane in applets and this
sounds to me like a related problem. Optimistically, I tried pasting in the
reported fix for the latter, ie:

JRootPane rp = myPanel.this.getRootPane();
rp.setClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

without success. The structure of my interface is rather complex with a lot of
classes so I can't really give you all the code to reproduce the exact problem,
but I'll do my best to give you the basic structure and hope you can offer me
some help...

public class MainInputPanel extends InputPanel
{

// this class is added to the ContentPane of a class that extends JInternalFrame
// In turn, the JInternalFrame is added to a class that extends JDesktopPane.
// The latter is added to the ContentPane of a class that extends JApplet

// calling JOptionPane.showMessageDialog() in the code below causes no probs
// whereas replacing the call with JOptionPane.showMessageDialog() causes
// Netscape to throw an AppletSecurityException

   /**
    *   Listener for buttons present on MainInputPanel form
    */
    class ButtonListener implements ActionListener
    {

      public void actionPerformed(ActionEvent event)
      {
        Object source = event.getSource();


            if(source == showGasDataPanelButton)
            {
               System.out.println("Heard gas panel show button");
               GasDataFrame gasFrame =
enclosingFrame_.getViewpacPane().getGasDataFrame();

               try
               {
                  MainInputPanel.this.copyEdits();
               }
               catch(NumberFormatException nfe)
               {
                  //Show warning dialog - the gas data panel options depend on the flow type selection
                  JOptionPane.showInternalMessageDialog
                  (     MainInputPanel.this,
                        nfe.getMessage(),
                        "Main input validation",
                        JOptionPane.WARNING_MESSAGE);

                  return;
               }

      }

   }

}

// external class InputPanel:

import javax.swing.*;
import com.esdu.glenrowan.viewpac.exception.viewpacexception.*;

public abstract class InputPanel extends JPanel
{
   abstract void initialiseForm();
   abstract void copyEdits();
   abstract void validateForm() throws InvalidViewpacInputDataException;
}
(Review ID: 106301) 
======================================================================

Comments
WORK AROUND Name: yyT116575 Date: 01/11/2001 None - I have resolved just to use the showMessageDialog() method instead and ignore the fact that those dialogs are then movable all over the screen, but I would much rather that all the dialogs displayed on the screen were confined to the same display context as the rest of the JInternalFrames I'm using!! ======================================================================
11-06-2004

SUGGESTED FIX Customer confirmed that this is not our bug. I will close this as "not a bug" margarita.fisher@East 2001-03-15
15-03-2001

EVALUATION I could reproduce this only with Netscape's plug-in, not our plug-in. Waiting from contact person to find out if customer is using Java Plug-in (<EMBED> tag and not <APPLET> tag in his html page) margarita.fisher@East 2001-02-27
27-02-2001