Skip to main content

It may not be an Out Of Memory Error but an AccessControlException

No replies
demonduck
Offline
Joined: 2008-03-14
Points: 0

Summary: My applet doesn't run locally in 6u11 but runs fine in 6u10 and older JRE's

I thought it was an OOME because I trap Throwable and assume it's an OOME because
there was a time when I was getting a lot of OOME.

So I put a printStackTrace() at the point where I was trapping a Throwable and I get this trace from both IE6 and FF2:

Java Plug-in 1.6.0_11
Using JRE version 1.6.0_11 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Administrator

PanCyl; v0.3.2 -- New JavaScript Response
java.security.AccessControlException: access denied (java.io.FilePermission D:\BlueHostSite\public_html\images\LakeMary_1.jpg read)
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.checkRead(Unknown Source)
at java.io.File.isDirectory(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.initializeHeaders(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getContentLength(Unknown Source)
at pancyl.PanCylImageFetch.getImageBytes(PanCylImageFetch.java:84)
at pancyl.PanCylImageFetch.run(PanCylImageFetch.java:248)
at java.lang.Thread.run(Unknown Source)

Now why would this happen trying to read a file from the local disk????

Here is a snippet from around the place in my code where the Throwable is generated:

try
{
if(canvas != null)
canvas.paintMsgScreen("Loading -- please wait...",applet.RELOAD);
URLConnection urlConnection = imageURL.openConnection();
//urlConnection.setConnectTimeout(8000);
if(cache)
urlConnection.setUseCaches(true);
else
urlConnection.setUseCaches(false);
//urlConnection.setReadTimeout(8000);
size = urlConnection.getContentLength(); <<<<<<< here is at pancyl.PanCylImageFetch.getImageBytes(PanCylImageFetch.java:84)

if(size <= 0)
{
if(canvas != null)
{
// canvas.KILLCACHINGINDICATOR = true;
canvas.paintMsgScreen("Image zero length...",applet.RELOAD);
}
return false;
}

And the exact same error happens in IE6:

Java Plug-in 1.6.0_11
Using JRE version 1.6.0_11 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Administrator

PanCyl; v0.3.2 -- New JavaScript Response
java.security.AccessControlException: access denied (java.io.FilePermission D:\BlueHostSite\public_html\images\LakeMary_1.jpg read)
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.checkRead(Unknown Source)
at java.io.File.isDirectory(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.initializeHeaders(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getContentLength(Unknown Source)
at pancyl.PanCylImageFetch.getImageBytes(PanCylImageFetch.java:84)
at pancyl.PanCylImageFetch.run(PanCylImageFetch.java:248)
at java.lang.Thread.run(Unknown Source)