diff options
author | Jiri Vanek <[email protected]> | 2012-05-29 17:38:27 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-05-29 17:38:27 +0200 |
commit | 4799d06d31c948378700559beff543a9eb9c2924 (patch) | |
tree | 777bcd9f849793999c0b0f8198d9932b23c46e02 /netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | |
parent | 918eeb21a0548d7a3edf4a388933be622ec0fd65 (diff) |
netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getPermissions): New rethrow of exceptions and following condition make more accurate
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java index 52333eb..2049498 100644 --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java @@ -914,22 +914,26 @@ public class JNLPClassLoader extends URLClassLoader { // 1. Code must be signed // 2. ALL or J2EE permissions must be requested (note: plugin requests ALL automatically) if (cs == null) { - throw new RuntimeException("Code source was null"); + throw new NullPointerException("Code source was null"); } - if (cs.getLocation() == null) { - throw new RuntimeException("Code source location was null"); - } - if (getCodeSourceSecurity(cs.getLocation()) == null) { - throw new RuntimeException("Code source security was null"); - } - if (getCodeSourceSecurity(cs.getLocation()).getSecurityType() == null) { - throw new RuntimeException("Code source security type was null"); - } - if (cs.getCodeSigners() != null - && (getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.ALL_PERMISSIONS) - || getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.J2EE_PERMISSIONS))) { + if (cs.getCodeSigners() != null) { + if (cs.getLocation() == null) { + throw new NullPointerException("Code source location was null"); + } + if (getCodeSourceSecurity(cs.getLocation()) == null) { + throw new NullPointerException("Code source security was null"); + } + if (getCodeSourceSecurity(cs.getLocation()).getSecurityType() == null) { + if (JNLPRuntime.isDebug()){ + new NullPointerException("Warning! Code source security type was null").printStackTrace(); + } + } + Object securityType = getCodeSourceSecurity(cs.getLocation()).getSecurityType(); + if (SecurityDesc.ALL_PERMISSIONS.equals(securityType) + || SecurityDesc.J2EE_PERMISSIONS.equals(securityType)) { - permissions = getCodeSourceSecurity(cs.getLocation()).getPermissions(cs); + permissions = getCodeSourceSecurity(cs.getLocation()).getPermissions(cs); + } } Enumeration<Permission> e = permissions.elements(); |