[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 Sep 15 06:39:13 PDT 2011


On 16:09 Tue 13 Sep     , Omair Majid wrote:
> On 05/06/2011 08:43 PM, Omair Majid wrote:
> > 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.
> >
> 
> Ping.

This got lost because it's on the end of a long (and old thread).

This looks ok now, but can you please post the current version of the patch
in a new thread to double-check?  Thanks.
-- 
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