/hg/icedtea-web: PR618: Can't install OpenDJ, JavaWebStart fails...

omajid at icedtea.classpath.org omajid at icedtea.classpath.org
Thu Sep 29 08:38:15 PDT 2011


changeset 3545cea5c845 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=3545cea5c845
author: Omair Majid <omajid at redhat.com>
date: Thu Sep 29 11:35:01 2011 -0400

	PR618: Can't install OpenDJ, JavaWebStart fails with Input stream is
	null error.

	2011-09-29 Omair Majid <omajid at redhat.com>

	 * NEWS: Update.
	    * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
	(getResource): Rename to ... (findResource): New method.
	(findResources): If resource can not be found, search in lazy
	resources. (findResourcesBySearching): New method.


diffstat:

 ChangeLog                                              |  13 ++++-
 NEWS                                                   |   1 +
 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |  53 ++++++++++++++---
 3 files changed, 56 insertions(+), 11 deletions(-)

diffs (117 lines):

diff -r fb883fdc9331 -r 3545cea5c845 ChangeLog
--- a/ChangeLog	Wed Sep 28 18:17:13 2011 -0400
+++ b/ChangeLog	Thu Sep 29 11:35:01 2011 -0400
@@ -1,4 +1,15 @@
-2011-09-28 Omair Majid <omajid at redhat.com>
+2011-09-29  Omair Majid  <omajid at redhat.com>
+
+	PR618: Can't install OpenDJ, JavaWebStart fails with Input stream is null
+	error.
+	* NEWS: Update.
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+	(getResource): Rename to ...
+	(findResource): New method.
+	(findResources): If resource can not be found, search in lazy resources.
+	(findResourcesBySearching): New method.
+
+2011-09-28  Omair Majid  <omajid at redhat.com>
 
 	* netx/net/sourceforge/jnlp/AppletDesc.java (getMainClass): Clarify the
 	return value in javadoc.
diff -r fb883fdc9331 -r 3545cea5c845 NEWS
--- a/NEWS	Wed Sep 28 18:17:13 2011 -0400
+++ b/NEWS	Thu Sep 29 11:35:01 2011 -0400
@@ -13,6 +13,7 @@
 	- RH718164, CVE-2011-2513: Home directory path disclosure to untrusted applications
 	- RH718170, CVE-2011-2514: Java Web Start security warning dialog manipulation
 * NetX
+  - PR618: Can't install OpenDJ, JavaWebStart fails with Input stream is null error
   - PR765: JNLP file with all resource jars marked as 'lazy' fails to validate signature and stops the launch of application
   - PR788: Elluminate Live! is not working
 * Plugin
diff -r fb883fdc9331 -r 3545cea5c845 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Wed Sep 28 18:17:13 2011 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Thu Sep 29 11:35:01 2011 -0400
@@ -1484,31 +1484,64 @@
     /**
      * Finds the resource in this, the parent, or the extension
      * class loaders.
+     *
+     * @return a <code>URL</code> for the resource, or <code>null</code>
+     * if the resource could not be found.
      */
-    public URL getResource(String name) {
-        URL result = super.getResource(name);
+    @Override
+    public URL findResource(String name) {
+        URL result = null;
 
-        for (int i = 1; i < loaders.length; i++)
-            if (result == null)
-                result = loaders[i].getResource(name);
+        try {
+            Enumeration<URL> e = findResources(name);
+            if (e.hasMoreElements()) {
+                result = e.nextElement();
+            }
+        } catch (IOException e) {
+            if (JNLPRuntime.isDebug()) {
+                e.printStackTrace();
+            }
+        }
         
         // If result is still null, look in the codebase loader
         if (result == null && codeBaseLoader != null)
-            result = codeBaseLoader.getResource(name);
+            result = codeBaseLoader.findResource(name);
 
         return result;
     }
 
     /**
-     * Finds the resource in this, the parent, or the extension
-     * class loaders.
+     * Find the resources in this, the parent, or the extension
+     * class loaders. Load lazy resources if not found in current resources.
      */
     @Override
     public Enumeration<URL> findResources(String name) throws IOException {
-        Vector<URL> resources = new Vector<URL>();
+        Enumeration<URL> resources = findResourcesBySearching(name);
+
+        try {
+            // if not found, load all lazy resources; repeat search
+            while (!resources.hasMoreElements() && addNextResource() != null) {
+                resources = findResourcesBySearching(name);
+            }
+        } catch (LaunchException le) {
+            le.printStackTrace();
+        }
+
+        return resources;
+    }
+
+    /**
+     * Find the resources in this, the parent, or the extension
+     * class loaders.
+     */
+    private Enumeration<URL> findResourcesBySearching(String name) throws IOException {
+        List<URL> resources = new ArrayList<URL>();
         Enumeration<URL> e;
 
         for (int i = 0; i < loaders.length; i++) {
+            // TODO check if this will blow up or not
+            // if loaders[1].getResource() is called, wont it call getResource() on
+            // the original caller? infinite recursion?
 
             if (loaders[i] == this)
                 e = super.findResources(name);
@@ -1527,7 +1560,7 @@
                 resources.add(e.nextElement());
         }
 
-        return resources.elements();
+        return Collections.enumeration(resources);
     }
 
     /**



More information about the distro-pkg-dev mailing list