From 7b561bedfe5dec3afe77574ef879b91f942db735 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 5 Nov 2013 13:26:59 -0500 Subject: 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 --- netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'netx/net/sourceforge/jnlp/runtime') 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 { -- cgit v1.2.3