changeset 514:855087771e7e

Fix for PR920: Classes attempted to load twice when class extends from outside jar
author Adam Domurad <adomurad@redhat.com>
date Tue, 28 Aug 2012 14:36:06 -0400
parents e7d3c75b2656
children 03803e23d0e6
files ChangeLog NEWS netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diffstat 3 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 28 14:32:12 2012 -0400
+++ b/ChangeLog	Tue Aug 28 14:36:06 2012 -0400
@@ -1,3 +1,11 @@
+2012-08-27  Adam Domurad  <adomurad@redhat.com>
+
+	Fixes PR920, duplicate loading of classes in certain cases 
+	* NEWS: Added entry: Fixes PR920
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: Remove 
+	recursive/non-recursive distinction. Add parent JNLPClassLoader to 
+	parent chain. 
+
 2012-08-27  Adam Domurad  <adomurad@redhat.com>
 
 	Reproduces problem behind PR920, class is in a jar is loaded twice when
--- a/NEWS	Tue Aug 28 14:32:12 2012 -0400
+++ b/NEWS	Tue Aug 28 14:36:06 2012 -0400
@@ -32,6 +32,7 @@
   - PR855: AppletStub getDocumentBase() doesn't return full URL
   - PR1011: Folders treated as jar files in archive tag
   - PR588: Cookies not written from cookie jar to browser cookies
+  - PR920: Classes attempted to load twice when class extends from outside jar
 * Common
   - PR918: java applet windows uses a low resulution black/white icon
   - RH838417: Disambiguate signed applet security prompt from certificate warning
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue Aug 28 14:32:12 2012 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue Aug 28 14:36:06 2012 -0400
@@ -1727,7 +1727,7 @@
 
         // Try codebase loader
         if (codeBaseLoader != null)
-            return codeBaseLoader.findClass(name, true);
+            return codeBaseLoader.findClass(name);
 
         // All else failed. Throw CNFE
         throw new ClassNotFoundException(name);
@@ -2201,7 +2201,7 @@
         ConcurrentHashMap<String, URL[]> notFoundResources = new ConcurrentHashMap<String, URL[]>();
 
         public CodeBaseClassLoader(URL[] urls, JNLPClassLoader cl) {
-            super(urls);
+            super(urls, cl);
             parentJNLPClassLoader = cl;
         }
 
@@ -2212,19 +2212,6 @@
 
         @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)))
                 throw new ClassNotFoundException(name);