aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diff options
context:
space:
mode:
authorJiri Vanek <jvanek@redhat.com>2012-08-27 12:50:29 +0200
committerJiri Vanek <jvanek@redhat.com>2012-08-27 12:50:29 +0200
commit36f7aeda80f29c9969099feb064985e1920518e9 (patch)
treeadc072b80c019c3d6dcb051870d6e7b452b9726a /netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
parentafffc63223a2307b01ec50c6ec4da839a88144f5 (diff)
Fixed long term failing unit-test, fixed NPE from ClassLoader
* netx/net/sourceforge/jnlp/NullJnlpFileException.java: new class to distinguish plain NPE from null jnlp file. * netx/net/sourceforge/jnlp/SecurityDesc.java: (getSandBoxPermissions) added throw of NullJnlpFileException in case of null jnlp file. * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (findClass) added Override annotation, add catch of NullJnlpFileException and re-throw of CNF exception. * tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java: (testResourceLoadSuccessCaching) (testResourceLoadFailureCaching) (testParentClassLoaderIsAskedForClasses) - internal JNLPFile's (getSecurity) null in SecurityDesc constructorrepalced by this. (testNullFileSecurityDesc) new test to ensure NPE in null JNLPFile case.
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index 5ec2e70..c30bc48 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -69,6 +69,7 @@ import net.sourceforge.jnlp.JNLPMatcher;
import net.sourceforge.jnlp.JNLPMatcherException;
import net.sourceforge.jnlp.LaunchDesc;
import net.sourceforge.jnlp.LaunchException;
+import net.sourceforge.jnlp.NullJnlpFileException;
import net.sourceforge.jnlp.ParseException;
import net.sourceforge.jnlp.PluginBridge;
import net.sourceforge.jnlp.ResourcesDesc;
@@ -1701,6 +1702,7 @@ public class JNLPClassLoader extends URLClassLoader {
/**
* Find the class in this loader or any of its extension loaders.
*/
+ @Override
protected Class findClass(String name) throws ClassNotFoundException {
for (int i = 0; i < loaders.length; i++) {
try {
@@ -1718,6 +1720,8 @@ public class JNLPClassLoader extends URLClassLoader {
} catch (ClassNotFoundException ex) {
} catch (ClassFormatError cfe) {
} catch (PrivilegedActionException pae) {
+ } catch (NullJnlpFileException ex) {
+ throw new ClassNotFoundException(this.mainClass + " in main classloader ", ex);
}
}
@@ -2233,7 +2237,10 @@ public class JNLPClassLoader extends URLClassLoader {
}, parentJNLPClassLoader.getAccessControlContextForClassLoading());
} catch (PrivilegedActionException pae) {
notFoundResources.put(name, super.getURLs());
- throw new ClassNotFoundException("Could not find class " + name);
+ throw new ClassNotFoundException("Could not find class " + name, pae);
+ } catch (NullJnlpFileException njf) {
+ notFoundResources.put(name, super.getURLs());
+ throw new ClassNotFoundException("Could not find class " + name, njf);
}
}
@@ -2297,7 +2304,7 @@ public class JNLPClassLoader extends URLClassLoader {
}
}, parentJNLPClassLoader.getAccessControlContextForClassLoading());
} catch (PrivilegedActionException pae) {
- }
+ }
if (url == null) {
notFoundResources.put(name, super.getURLs());