aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diff options
context:
space:
mode:
authorOmair Majid <[email protected]>2012-06-28 14:53:07 -0400
committerOmair Majid <[email protected]>2012-06-28 14:53:07 -0400
commit16f2e7d40c05927c5d911380a24d11dec4f31263 (patch)
treeb93ac79d7ad4225bd28c6df06a93074b62ca774b /netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
parent40f30149bcd80661a1df5ec0570d1b7c0124c3c3 (diff)
Fix problem in resolving classes
The bug manifests when the following sequence of steps happen: 1. An applet with both a codebase and a jar (archive) is loaded 2. A class Foo is loaded using the codebase classloader 3. The Foo class tries to load a class Bar that is specified in the jar archive. The Bar class is not found. The following applet reproduces the problem: http://javadjvu.foxtrottechnologies.com/cgi-bin/djvuapplet.pl/examples/deer.djvu?zoom=page The fix addresses the problem by ensuring that the codebase classloader asks the classloader that knows about the jar archive to resolve classes too.
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index e487cb6..abdba94 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -1577,8 +1577,8 @@ public class JNLPClassLoader extends URLClassLoader {
// Try codebase loader
if (codeBaseLoader != null)
- return codeBaseLoader.findClass(name);
-
+ return codeBaseLoader.findClass(name, true);
+
// All else failed. Throw CNFE
throw new ClassNotFoundException(name);
}
@@ -2060,6 +2060,18 @@ public class JNLPClassLoader extends URLClassLoader {
@Override
public Class<?> findClass(String name) throws ClassNotFoundException {
+ return findClass(name, false);
+ }
+
+ public Class<?> findClass(String name, boolean recursivelyInvoked) throws ClassNotFoundException {
+
+ if (!recursivelyInvoked) {
+ try {
+ return parentJNLPClassLoader.findClass(name);
+ } catch (ClassNotFoundException cnfe) {
+ // continue
+ }
+ }
// If we have searched this path before, don't try again
if (Arrays.equals(super.getURLs(), notFoundResources.get(name)))