3

I have a signed Applet that loads images. Applet has background threads retrieving images from server. Initially Applet loads images with no problem, but after loading about 7 images I'm getting below error:

java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.io.tmpdir" "read")
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at java.lang.System.getProperty(Unknown Source)

It is throwing error when doing this

System.getProperty("java.io.tmpdir")

But like I said initially I'm able to read thatt system property, but then all the sudden stops working.

Anyone know why this could happen? Could other Applet background threads be locking reading that system property? Because of this, javax.imageio.ImageIO.read will eventually throw error, since it can't access the system property.

Thanks in advance!

Marquinio
  • 4,601
  • 13
  • 45
  • 68
  • Not sure why this happens for a signed applet (I assume you also have the correct permissions), but if you use `ImageIO.setUseCache(false)` you should be able to disable the disk caching (which is using the temp dir) and instead use in-memory caching. As a bonus, it will also be faster. :-) – Harald K Aug 07 '15 at 17:02

0 Answers0