Reputation: 19344
I having a weird behavior when my applet stops in a webbrowser
Exception in thread "SwingWorker-pool-1-thread-3" java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:214)
at java.lang.Thread.checkAccess(Thread.java:1330)
at java.lang.Thread.interrupt(Thread.java:903)
at java.util.concurrent.ThreadPoolExecutor$Worker.interruptIfIdle(ThreadPoolExecutor.java:844)
at java.util.concurrent.ThreadPoolExecutor.interruptIdleWorkers(ThreadPoolExecutor.java:994)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:952)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:680)
can anybody explain this problem ?
Jason
while tracking down another bug I got round to simplifying my code to its minimum and in the process located what tirgers this exception:
new ImageLoaderWorker(this,background.setCoordinatesCenter(400, 240)).execute();
background contains useful information like path dimension etc.
ImageLoaderWorker is as defined:
public class ImageLoaderWorker extends SwingWorker<ImageIcon, Void> {
@Override
public ImageIcon doInBackground() {
System.err.println("do in background");
return loadImage();
}
@Override
public void done() {
System.err.println("done");
try {
if(!sskkWhitePages.containsKey(iich.getName())){
sskkWhitePages.put(iich.getName(), get());
}
iich.transfertImage();
if(callback != null){
callback.imageLoaded(iich.getName());
}
} catch (InterruptedException ignore) {}
catch (java.util.concurrent.ExecutionException e) {
String why = null;
Throwable cause = e.getCause();
if (cause != null) {
why = cause.getMessage();
} else {
why = e.getMessage();
}
System.err.println("Error retrieving file: " + why);
}
}
/**
* Load the image for the specified frame of animation. Since
* this runs as an applet, we use getResourceAsStream for
* efficiency and so it'll work in older versions of Java Plug-in.
*/
protected ImageIcon loadImage() {
//Not really relevant to the problem I think so I skipped it to avoir overloading the question
}
Upvotes: 1
Views: 310
Reputation: 718866
I think this could be a JDK bug - see this NetBeans bug report.
The NetBeans bug report cites a JDK bug id and says it is fixed in Java 6. But the cited JDK bug is no longer accessible.
If your browser has a Java 5 plugin, this is a plausible explanation, and a plausible fix would be to upgrade the plugin to Java 6.
Upvotes: 1