Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4402169

javax.swing.JComponent.remove() does not work in applet mode

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6
    • Verified



      Name: ooR10001 Date: 01/05/2001


      javax.swing.JComponent.remove() method fails when the attempt to invoke it
      in appletviewer is made. It causes unexpected
      java.security.AccessControlException
      in jdk version b46. It needs to be fixed.

      Following test demonstrates this bug:
      ----------------------------------------------
      --- test.java ---
      import javax.swing.JFrame;
      import javax.swing.JPanel;

      public class test extends java.applet.Applet {

        public void init() {
            JFrame f = new JFrame();
            JPanel p = new JPanel();
            f.getContentPane().add(p);
            f.setVisible(true);
            f.getContentPane().remove(p);
            f.dispose();
            System.out.println("OKAY");
        }
      }
      --- test.html ---
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.X//EN">

      <html>
        <head>
          <title>Test</title>
        </head>

        <body>
            <h1>Test</h1>
            <p> <hr>
            <applet
              code="test"
              codebase="."
              width=400 height=350
            >
            </applet>

        </body>
      </html>
      ----------------------

      Test output:
      %java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b46)
      Java HotSpot(TM) Client VM (build 1.4beta-B45, mixed mode)

      java.security.AccessControlException: access denied (java.io.FilePermission
      /home/oov/.javaUserPrefs read)
              at
      java.security.AccessControlContext.checkPermission(AccessControlContext.java:274)
              at java.security.AccessController.checkPermission(AccessController.java:400)
              at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
              at java.lang.SecurityManager.checkRead(SecurityManager.java:890)
              at java.io.File.list(File.java:777)
              at java.io.File.listFiles(File.java:857)
              at
      java.util.prefs.FileSystemPreferences.childrenSpi(FileSystemPreferences.java:348)
              at java.util.prefs.AbstractPreferences.children(AbstractPreferences.java:612)
              at java.util.prefs.AbstractPreferences.getChild(AbstractPreferences.java:1091)
              at java.util.prefs.AbstractPreferences.nodeExists(AbstractPreferences.java:787)
              at java.util.prefs.AbstractPreferences.nodeExists(AbstractPreferences.java:771)
              at
      sun.awt.im.ExecutableInputMethodManager.readPreferredInputMethod(InputMethodManager.java:
      682)
              at
      sun.awt.im.ExecutableInputMethodManager.getPreferredInputMethod(InputMethodManager.java:6
      34)
              at
      sun.awt.im.ExecutableInputMethodManager.findInputMethod(InputMethodManager.java:593)
              at sun.awt.im.InputContext.selectInputMethod(InputContext.java:141)
              at sun.awt.im.InputContext.<init>(InputContext.java:113)
              at sun.awt.im.InputMethodContext.<init>(InputMethodContext.java:73)
              at java.awt.im.InputContext.getInstance(InputContext.java:77)
              at java.awt.Window.getInputContext(Window.java:702)
              at java.awt.Component.getInputContext(Component.java:4495)
              at java.awt.Component.getInputContext(Component.java:4495)
              at java.awt.Component.getInputContext(Component.java:4495)
              at java.awt.Component.getInputContext(Component.java:4495)
              at java.awt.Component.removeNotify(Component.java:5270)
              at java.awt.Container.removeNotify(Container.java:1885)
              at javax.swing.JComponent.removeNotify(JComponent.java:3989)
              at java.awt.Container.remove(Container.java:521)
              at java.awt.Container.remove(Container.java:571)
              at test.init(test.java:11)
              at sun.applet.AppletPanel.run(AppletPanel.java:344)
              at java.lang.Thread.run(Thread.java:579)
      ----------------------

      ======================================================================

            kkladkosunw Konstantin Kladko (Inactive)
            oovsunw Oov Oov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: