diff options
author | Andrew Azores <[email protected]> | 2013-11-05 13:26:59 -0500 |
---|---|---|
committer | Andrew Azores <[email protected]> | 2013-11-05 13:26:59 -0500 |
commit | 7b561bedfe5dec3afe77574ef879b91f942db735 (patch) | |
tree | 96461f01196dc0426e3200cc7a20ee7bc39c9937 /netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java | |
parent | f7d9707866ab118b6981207be54ab78c8b022fdc (diff) |
Avoid potential NPE in JNLPSecurityManager#addPermission when debug is enabled
* netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java:
(addPermission) avoid NPE in JNLPClassLoader#getPermissions with debug
enabled
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java index 5c69b01..d3ba810 100644 --- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java +++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java @@ -317,10 +317,14 @@ class JNLPSecurityManager extends AWTSecurityManager { JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader(); cl.addPermission(perm); if (JNLPRuntime.isDebug()) { - if (cl.getPermissions(null).implies(perm)){ - OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Added permission: " + perm.toString()); + if (cl.getSecurity() == null) { + if (cl.getPermissions(null).implies(perm)){ + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Added permission: " + perm.toString()); + } else { + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Unable to add permission: " + perm.toString()); + } } else { - OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Unable to add permission: " + perm.toString()); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Cannot get permissions for null codesource when classloader security is not null"); } } } else { |