2

I am running a self signed applet using the deployApplet.js library from Oracle. (Checking the generated html, it is using the applet tag - I am also using a JNLP file per the deployment tutorials from Oracle).

The problem occurs when the user is presented with the dialog requesting permission to access their computer. If they click Allow everything is fine. If they click Deny I get the following exception in the Java Console:

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)

The browser hangs after this and I need to manually kill the Java Applet process or restart the browser. Based on the stack trace and from doing some static initializer debug steps in my applet, it does not appear that any code in my applet gets executed before the exception is thrown.

Is there any way to recover gracefully when the user clicks Deny? Ideally, the applet and JVM would just exit cleanly but I am open to anything that would not leave the browser hanging.

EDIT:

Additional log info before exception is thrown:

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
Jesse Vogt
  • 16,229
  • 16
  • 59
  • 72
  • *"Is there any way to recover gracefully when the user clicks Deny?"* You must be using the Oracle JRE. An [Iced Tea JRE would not load the code](http://stackoverflow.com/questions/5356850/does-this-applet-work-in-an-iced-tea-jre) if the user refused the trust prompt. – Andrew Thompson Jul 27 '12 at 23:22
  • Locally I am using what the current version that Apple ships with 10.7. I am assuming though that this problem is dependent on what JRE the end user has, correct? – Jesse Vogt Jul 28 '12 at 13:45
  • Using JavaScript to detect the missing/sand-boxed applet and redirecting to another page is probably the best you can hope for. – Andrew Thompson Jul 30 '12 at 01:04
  • Any tips on how that would work? When the user clicks Deny the browser (current Chrome and FF) hang hard and need to be restarted. – Jesse Vogt Jul 30 '12 at 13:54

0 Answers0