changeset 408:f4f02e8c080d

netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getPermissions): New rethrow of exceptions and following condition make more accurate
author Jiri Vanek <jvanek@redhat.com>
date Tue, 29 May 2012 17:38:27 +0200
parents 526df16b6e27
children 017d474ea1e5
files ChangeLog netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diffstat 2 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 29 15:54:14 2012 +0200
+++ b/ChangeLog	Tue May 29 17:38:27 2012 +0200
@@ -1,4 +1,9 @@
-2012-05-20  Jiri Vanek  <jvanek@redhat.com>
+2012-05-29  Jiri Vanek  <jvanek@redhat.com>
+
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getPermissions):
+	New rethrow of exceptions and following condition make more accurate. 
+
+2012-05-29  Jiri Vanek  <jvanek@redhat.com>
 
 	Get rid of repeated sout/serr  in reproducers testcases/unit tests and
 	introduce bottleneck for loging.
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue May 29 15:54:14 2012 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue May 29 17:38:27 2012 +0200
@@ -914,22 +914,26 @@
                 // 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");
-                }
-                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");
+                    throw new NullPointerException("Code source 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();