2011-06-08 55 views
1

我有,当我的小程序在web浏览器小程序:异常触发接近

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) 

停止任何人可以解释这个问题一个怪异的行为?

杰森


同时跟踪另一个bug我得到全面简化我的代码到最小,并在位于过程是什么tirgers此异常:

new ImageLoaderWorker(this,background.setCoordinatesCenter(400, 240)).execute(); 

背景包含类似路径的有用信息维等

ImageLoaderWorker被定义为:

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 
} 
+0

貌似在插件或安全设置的错误。你使用哪种浏览器/操作系统/插件组合? – 2011-06-08 23:15:25

+0

在这种情况下我使用了mac os 10.6和safari。 – 2011-06-08 23:27:27

+1

'访问被拒绝(java.lang.RuntimePermission modifyThread)'你为什么试图修改线程?如果这确实是必要的,请使用可信的小程序。 – 2011-06-09 00:41:37

回答

1

我认为这可能是一个JDK错误 - 请参阅此NetBeans bug report

NetBeans错误报告引用了JDK错误ID,并表示它已在Java 6中修复。但引用的JDK错误不再可访问。

如果你的浏览器有一个Java插件5,这是一个合理的解释和合理的解决将是该插件升级到Java 6