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

Method sun.awt.motif.MToolkit.getImage(URL) does not work in appletviewer.

    XMLWordPrintable

    Details

      Description



      Name: aaC67449 Date: 01/29/98



      Method sun.awt.motif.MToolkit.getImage(URL), throws strange Exception (AccessControlException:connect from mars to denied), when tries to get systemresource Image in secure environment (loading applet via http and appletviewer.security.mode=host). Thus many methods in swing classes do not work in this enviroment.


      -------------------Example-----------------------------------
      import java.awt.swing.*;
      import java.applet.*;
      import java.net.*;
      import java.awt.*;
      public class Test1 extends Applet {

        public void init() {

         URL url=UIManager.getLookAndFeel()
                              .getClass().getResource("icons/TreeClosed.gif");
         
         System.out.println("URL:"+url);
         System.out.println("Toolkit:"+Toolkit.getDefaultToolkit());

         Image image = Toolkit.getDefaultToolkit().getImage(url);

        }

      }

      -------------------Output------------------------------------
      #>grep appletviewer.security.mode ~/.hotjava/properties
      appletviewer.security.mode=host
      #>appletviewer http://mars:8080/~ali/test1.html
      URL:systemresource:/ZIP/set/java/JDK1.2-Beta3D/solaris/lib/classes.zip/+/java/awt/swing/motif/icons/TreeClosed.gif
      Toolkit:sun.awt.motif.MToolkit@d37d29b2
      java.security.AccessControlException: connect from mars to denied
              at sun.applet.AppletSecurity.checkConnect(AppletSecurity.java:337)
              at sun.applet.AppletSecurity.checkConnect(AppletSecurity.java:390)
              at sun.applet.AppletSecurity.checkConnect(AppletSecurity.java:278)
              at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:89)
              at sun.awt.SunToolkit.getImage(SunToolkit.java:123)
              at Test1.init(Test1.java:14)
              at sun.applet.AppletPanel.run(AppletPanel.java:283)
              at java.lang.Thread.run(Thread.java:490)


      # another case
      #>grep appletviewer.security.mode ~/.hotjava/properties
      appletviewer.security.mode=unrestricted
      #>appletviewer http://mars:8080/~ali/test1.html
      URL:systemresource:/ZIP/set/java/JDK1.2-Beta3D/solaris/lib/classes.zip/+/java/awt/swing/motif/icons/TreeClosed.gif
      Toolkit:sun.awt.motif.MToolkit@d37d29b2


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

        Attachments

          Activity

            People

            Assignee:
            jmcilreesunw James Mcilree (Inactive)
            Reporter:
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: