Well, I was a little mistaken. Apparently they do add some security checks.
And a particularly strange one is a security check on System.exit().
Actually, it makes sense to restrict calls to System.exit() but the way I've discovered it is surprising: I just moved a JFrame (made with Matisse) from the Java app to the platform. And by default, JFrames, have EXIT_ON_CLOSE set.
Well, on the Platform, the JFrame won't even show up ! Why ? Because of the EXIT_ON_CLOSE property. It eventually boils down to something like:
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkExit(0);
}
which fails inside the platform with an org.netbeans.ExitSecurityException .
So the problem is that initComponents() throws this unchecked exception so the entire new Frame().setVisible(true) call fails. Even more: this doesn't show up in the logs!
Btw, System.exit() works just fine during ModuleInstall. It's LifecycleManager that breaks down at that (early) point.
No comments:
Post a Comment