java.lang.SecurityException when calling Image.IO.Read inside applet

Started by richardadams, January 28, 2010, 19:02:08

Previous topic - Next topic

richardadams

Hi Everyone,

I have an applet loaded via the AppletLoader which loads and runs as expected.  During the initialisation of this applet I call

java.awt.Image image = ImageIO.read(stream);

No problems the jpg gets loaded as expected.  However when I call a public function of the applet (via getApplet()) the very same code generates the following exception

java.lang.SecurityException: Unable to create temporary file

The applet is signed, i've checked and double checked.  Can anyone explain why this might be happening?

Thanks in advance.

kappa

care to paste the whole exception from the java console? bit difficult to tell from just that snippet you've provided.

kappa

hmm, hard to say.

which OS, Java version and browser are you using?

is it possible you could provide a link to the applet, so i can see if i can reproduce the error here?

richardadams

Certainly,

Window XP SP3 & Java 1.6.18.

Can I email you the link?  The site's under development and I can't have it indexed just yet :)

kappa


kappa

thx, just tried but i'm on linux, it seems to be missing the linux_natives.jar


kappa

now i get an unable to validate certificate chain error. remember the certificates in the natives jars, should be the same as that of the lwjgl_util_applet.jar

richardadams

Hmm everything's signed with my own certificate cold it be a caching issue?

richardadams

Hi,

Let me know if it's still not working for you.  I'll create a new page with a simple applet that demonstrates the problem and send you the source.

Thanks.

kappa


richardadams

Lord, really sorry I copied the wrong one up.  It is now.

Applolgies for that.

kappa

works great for me now. see a model in the middle of the page and you can rotate around it.

not sure why it's still not working for you, make sure you haven't corrupted your cache somehow with an older version of lwjgl, if you suspect that try change the al_title value and clear the java cache from the java control panel.

kappa

further check all your jars are signed, (just open them with a zip program and see if the META-INF folder has the certificates in there)

richardadams

OK the problem occurs when you hit one of the image logos below the main window.  That's when the public function gets called via javascript and the error occurs.

This is the code from the public the function

   InputStream stream = null;   
   URL file = null;
      
   try {
      file = new URL(modelUrl + ".jpg");
   } catch (MalformedURLException e) {
      e.printStackTrace();
   }
      
   try {
      stream = file.openStream();
   } catch (IOException e) {
      e.printStackTrace();
   }
      
   try {
      java.awt.Image image = ImageIO.read(stream);
   } catch (IOException e) {
      e.printStackTrace();
}

The exception occurs when we get to the following line, but only when the function is called from Javascript not during initialisation.

java.awt.Image image = ImageIO.read(stream);