Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6684104
Votes 0
Synopsis Applets fails to launch using ImageIO if .java.policy with File permissions present on the system
Category java:imageio
Reported Against
Release Fixed 7(b63)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6708886
Submit Date 03-APR-2008
Description
if .java.policy file is present on the system then applet using ImageIO API to read the image fails to load by throwing Security exception as follows

java.security.AccessControlException: access denied (java.io.FilePermission C:\DOCUME~1\jitu\LOCALS~1\Temp\imageio45947.tmp delete)
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkDelete(Unknown Source)
	at java.io.File.delete(Unknown Source)
	at javax.imageio.stream.FileCacheImageInputStream$StreamDisposerRecord.dispose(Unknown Source)
	at javax.imageio.stream.FileCacheImageInputStream.close(Unknown Source)
	at javax.imageio.ImageIO.read(Unknown Source)
	at javax.imageio.ImageIO.read(Unknown Source)
	at MainGetResourceApplet.loadTheResource(MainGetResourceApplet.java:85)
	at MainGetResourceApplet.access$000(MainGetResourceApplet.java:10)
	at MainGetResourceApplet$1.run(MainGetResourceApplet.java:58)
	at java.lang.Thread.run(Unknown Source)

Steps to reproduce:
------------------
Make sure that there is no .java.policy file exists on the system
1) Install 6u10 and load following applet inside the browser
http://sqeweb.sfbay.sun.com/deployment2/jitu/plugInTestsNoHarness/Liveconnect/html/MainGetResourceImageApplet.html

You can notice that applet loads fine
2)Close the browser(make sure that you dispose all the instances of browser)
3) Now create a .java.policy file inside <user_home> as follows
grant {
  permission java.io.FilePermission "<<ALL FILES>>", "read, write";
};
4)Load the same applet again inside the browser
http://sqeweb.sfbay.sun.com/deployment2/jitu/plugInTestsNoHarness/Liveconnect/html/MainGetResourceImageApplet.html

If applet fails to load with above mentioned exception getting thrown on the Java console then bug is reproduced
Posted Date : 2008-04-03 19:42:21.0
Work Around
N/A
Evaluation
The problem there is caused by insufficient permissions to delete a temporary
 cache file.
 Suggested fix adds explicit check for read, write, and delete permissions for
 files in the cache directory (according to FilePermission spec, we should use
 path like /path/to/cachedir/* for this).

 If any of required permissions is not granted, ImageIO switches to memory-cached
 streams to avoid the problem described in this CR.
Posted Date : 2009-06-02 09:10:02.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang