[icedtea-web] RFC: PR618 - Can't install OpenDJ, JavaWebStart fails with Input stream is null error.

Omair Majid omajid at redhat.com
Fri May 6 17:43:48 PDT 2011


On 04/21/2011 05:59 PM, Dr Andrew John Hughes wrote:
> 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

Updated patch attached.

>
>> >  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.
>

Fixed.

>> >  +            if (e.hasMoreElements()) {
>> >  +                result = e.nextElement();
>> >  +            }
>> >  +        } catch (IOException e) {
>> >  +            // continue
> Should we not at least log this if debugging mode is on?

Done.

>
>> >  +    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?

fineResources, which overrides a method with the same name in 
ClassLoader and calls findResourcesBySearching, has to return an 
Enumeration. To avoid conversions from an iterator to enumeration, I am 
making findResourcesBySearching return an enumeration. I can change it 
if you insist.

Cheers,
Omair
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lazy-load-resources-05.patch
Type: text/x-patch
Size: 3456 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20110506/f7257cd6/lazy-load-resources-05.patch 


More information about the distro-pkg-dev mailing list