-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
1.2.0
-
sparc
-
solaris_2.5.1
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
======================================================================