United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6481004 SplashScreen.getSplashScreen() fails in Web Start context
JDK-6481004 : SplashScreen.getSplashScreen() fails in Web Start context

Details
Type:
Bug
Submit Date:
2006-10-12
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
generic
Sub-Component:
java.awt
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Relates:

Sub Tasks

Description
I have an existing application that uses the new SplashScreen API added in JDK 6.
I tried to migrate it from a standalone app to a Java Web Start app, and ran into
the following exception:

----
java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.splashscreen)
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
	at java.security.AccessController.checkPermission(AccessController.java:546)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
	at java.lang.SecurityManager.checkLink(SecurityManager.java:818)
	at java.lang.Runtime.loadLibrary0(Runtime.java:817)
	at java.lang.System.loadLibrary(System.java:1030)
	at java.awt.SplashScreen.getSplashScreen(SplashScreen.java:91)
	at SSTest.main(SSTest.java:5)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.javaws.Launcher.executeApplication(Launcher.java:1205)
	at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1151)
	at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:998)
	at com.sun.javaws.Launcher.run(Launcher.java:105)
	at java.lang.Thread.run(Thread.java:619)
----

Since Java Web Start is now using the new SplashScreen API under the hood, I would
expect to be able to add a splash screen to my webstarted app via:
    <icon kind="splash" href="splash.png"/>
and then add a progress bar or something similar to that splash screen using the
new JDK 6 APIs.  (If my expectation is incorrect, then we should at least return
null from getSplashScreen(); this exception is obviously not the correct behavior.
But I see no reason why the SplashScreen stuff shouldn't work in a Web Start
scenario.)

To reproduce:
1. Place the attached files in the /tmp directory.
2. cd /tmp
3. javaws SSTest.jnlp

                                    

Comments
EVALUATION

The following code in SplashScreen.getSplashScreen() needs to be in a
doPrivileged() block:
    System.loadLibrary("splashscreen");
                                     
2006-10-12
SUGGESTED FIX

--- SplashScreen.java	Thu Oct 12 14:57:57 2006
***************
*** 90,96 ****
              }
              // SplashScreen class is now a singleton
              if (!wasClosed && theInstance == null) {
!                 System.loadLibrary("splashscreen");
                  long ptr = _getInstance();
                  if (ptr != 0 && _isVisible(ptr)) {
                      theInstance = new SplashScreen(ptr);
--- 90,97 ----
              }
              // SplashScreen class is now a singleton
              if (!wasClosed && theInstance == null) {
!                 java.security.AccessController.doPrivileged(
!                     new sun.security.action.LoadLibraryAction("splashscreen"));
                  long ptr = _getInstance();
                  if (ptr != 0 && _isVisible(ptr)) {
                      theInstance = new SplashScreen(ptr);
                                     
2006-10-12



Hardware and Software, Engineered to Work Together