从用户点击“请求访问您的计算机”对话框中的“拒绝”从applet恢复

时间:2012-07-27 21:12:46

标签: java applet

我正在使用Oracle的deployApplet.js库运行自签名小程序。 (检查生成的html,它使用applet标记 - 我也根据Oracle的部署教程使用JNLP文件。)

当向用户显示请求访问其计算机的权限的对话框时,会出现此问题。如果他们点击允许一切正常。如果他们单击Deny,我会在Java控制台中收到以下异常:

ExitException[ 4]java.lang.RuntimeException: exit(-1)
    at com.sun.javaws.Main.systemExit(Main.java:1316)
    at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(AppPolicy.java:283)
    at com.sun.javaws.LaunchDownload.checkSignedResourcesHelper(LaunchDownload.java:1825)
    at com.sun.javaws.LaunchDownload.checkSignedResources(LaunchDownload.java:1508)
    at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(JNLP2Manager.java:1161)
    at sun.plugin2.applet.JNLP2Manager.loadJarFiles(JNLP2Manager.java:473)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1495)
    at java.lang.Thread.run(Thread.java:680)
Exception: ExitException[ 4]java.lang.RuntimeException: exit(-1)
java.lang.NullPointerException
    at sun.plugin.util.ErrorPanel.deniedCertificateFailure(ErrorPanel.java:334)
    at sun.plugin.util.ErrorPanel.<init>(ErrorPanel.java:61)
    at sun.plugin.util.GrayBoxPanel.setError(GrayBoxPanel.java:104)
    at sun.plugin.util.GrayBoxPainter.paintGrayBox(GrayBoxPainter.java:473)
    at sun.plugin.util.GrayBoxPainter$4.run(GrayBoxPainter.java:411)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:643)
    at java.awt.EventQueue$1.run(EventQueue.java:641)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:652)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

浏览器在此之后挂起,我需要手动终止Java Applet进程或重新启动浏览器。基于堆栈跟踪和在我的applet中执行一些静态初始化程序调试步骤,似乎在我的applet中的任何代码都在抛出异常之前被执行。

当用户点击拒绝时,有没有办法优雅地恢复?理想情况下,applet和JVM只会干净利落地退出,但我对任何不会让浏览器挂起的东西持开放态度。

编辑:

抛出异常之前的其他日志信息:

security: Showing MacOSXTrustSiteDialog
security: User permitted app to continue without priviledges
security: User has denied the privileges to the code
security: Adding certificate in Deployment denied certificate store
security: Added certificate in Deployment denied certificate store
security: We were not granted permission, exiting
basic: exception: exit(-1).
Java Plug-in 1.6.0_31
Using JRE version 1.6.0_31-b04-415-11M3646 Java HotSpot(TM) 64-Bit Server VM

0 个答案:

没有答案