classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Re: RFC: Don't call protected addURL() method from URLClass


From: Mark Wielaard
Subject: [cp-patches] Re: RFC: Don't call protected addURL() method from URLClassLoader constructors
Date: Wed, 19 Oct 2005 18:44:56 +0200

Hi Andrew,

On Wed, 2005-10-19 at 17:36 +0100, Andrew Haley wrote:
> > 2005-10-19  Mark Wielaard  <address@hidden>
> > 
> >     * java/net/URLClassLoader.java (addURLs): Don't call addURL(), but
> >     call urls.add() and addURLImpl() directly on each URL.
> > 
> > Andrew, I know you hacked on this code to get Jonas running nicely.
> > Could you check that this doesn't break anything for you? We don't want
> > to loose that nice 96.79% success rate!
>
> You really shouldn't consider committing a patch like this without
> adding comments.  After all, what is to stop someone changing it back?

Testing of know good applications.
But I see your point. Does the attached work for you?

Cheers,

Mark
Index: java/net/URLClassLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v
retrieving revision 1.40
diff -u -r1.40 URLClassLoader.java
--- java/net/URLClassLoader.java        2 Oct 2005 22:58:41 -0000       1.40
+++ java/net/URLClassLoader.java        19 Oct 2005 16:44:18 -0000
@@ -754,13 +754,20 @@
   }
 
   /**
-   * Adds an array of new locations to the end of the internal URL store.
+   * Adds an array of new locations to the end of the internal URL
+   * store.  Called from the the constructors. Should not call to the
+   * protected addURL() method since that can be overridden and
+   * subclasses are not yet in a good state at this point.
+   *
    * @param newUrls the locations to add
    */
   private void addURLs(URL[] newUrls)
   {
     for (int i = 0; i < newUrls.length; i++)
-      addURL(newUrls[i]);
+      {
+       urls.add(newUrls[i]);
+       addURLImpl(newUrls[i]);
+      }
   }
 
   /**

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]