[icedtea-web] RFC: PR618 - Can't install OpenDJ, JavaWebStart fails with Input stream is null error.
Dr Andrew John Hughes
ahughes at redhat.com
Thu Apr 21 14:59:42 PDT 2011
On 17:09 Fri 15 Apr , Omair Majid wrote:
> On 04/15/2011 04:55 PM, Dr Andrew John Hughes wrote:
> >
> > Can you start a clean thread with the current version of the patch?
> > The previous e-mail was pretty unreadable for me.
>
> Here you go. Attached.
>
> As explained earlier, it fixes PR618, buy allowing lazy loading to work
> when trying to find resources using getResource(s)/findResource(s).
>
> Any thoughts or comments?
>
> Cheers,
> Omair
Inline.
> diff -r 5454292b3fae netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
> --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Thu Mar 10 15:42:01 2011 -0500
> +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Mon Mar 14 11:07:15 2011 -0400
> @@ -40,7 +40,6 @@
> import java.util.List;
> import java.util.Map;
> import java.util.TreeSet;
> -import java.util.Vector;
> import java.util.jar.JarEntry;
> import java.util.jar.JarFile;
>
> @@ -1123,31 +1122,54 @@
> /**
> * 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);
Just a stylistic thing, but it's usually Enumeration<URL> without the space.
> + if (e.hasMoreElements()) {
> + result = e.nextElement();
> + }
> + } catch (IOException e) {
> + // continue
Should we not at least log this if debugging mode is on?
> + 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);
> @@ -1166,7 +1188,7 @@
> resources.add(e.nextElement());
> }
>
> - return resources.elements();
> + return Collections.enumeration(resources);
> }
>
Probably asked this last time, but remind why we return an Enumeration and not an Iterator when
resources is a List?
> /**
--
Andrew :)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37
More information about the distro-pkg-dev
mailing list