From dev-return-75492-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Wed Oct 04 21:19:05 2006 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 15915 invoked from network); 4 Oct 2006 21:19:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Oct 2006 21:19:04 -0000 Received: (qmail 9165 invoked by uid 500); 4 Oct 2006 21:19:03 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 9124 invoked by uid 500); 4 Oct 2006 21:19:03 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 9113 invoked by uid 500); 4 Oct 2006 21:19:03 -0000 Received: (qmail 9109 invoked by uid 99); 4 Oct 2006 21:19:03 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Oct 2006 14:19:03 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME Received: from [140.211.166.113] ([140.211.166.113:61956] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 01/84-20288-64524254 for ; Wed, 04 Oct 2006 14:19:02 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 6910E1A981A; Wed, 4 Oct 2006 14:19:00 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r453032 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/AntClassLoader.java src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java Date: Wed, 04 Oct 2006 21:19:00 -0000 To: ant-cvs@apache.org From: peterreilly@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061004211900.6910E1A981A@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: peterreilly Date: Wed Oct 4 14:18:59 2006 New Revision: 453032 URL: http://svn.apache.org/viewvc?view=rev&rev=453032 Log: another go at bugzilla 38747, isolate resources get the baseloader for resources in isolate mode Modified: ant/core/trunk/WHATSNEW ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=453032&r1=453031&r2=453032 ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Wed Oct 4 14:18:59 2006 @@ -44,10 +44,6 @@ * Added resource collection for convenient creation of string resources from other resources' content. Inspired by Bugzilla 40504. -* REVERTED for the moment: AntClassLoader did not isolate - resources when isolate was set. Bugzilla report 38747. - - Changes from Ant 1.7.0Beta1 to Ant 1.7.0Beta2 ============================================= Modified: ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java?view=diff&rev=453032&r1=453031&r2=453032 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java Wed Oct 4 14:18:59 2006 @@ -872,6 +872,18 @@ } /** + * Used for isolated resource seaching. + * @return the root classloader of AntClassLoader. + */ + private ClassLoader getRootLoader() { + ClassLoader ret = getClass().getClassLoader(); + while (ret != null && ret.getParent() != null) { + ret = ret.getParent(); + } + return ret; + } + + /** * Finds the resource with the given name. A resource is * some data (images, audio, text, etc) that can be accessed by class * code in a way that is independent of the location of the code. @@ -913,9 +925,13 @@ if (url == null && !isParentFirst(name)) { // this loader was first but it didn't find it - try the parent - - url = (parent == null) ? super.getResource(name) - : parent.getResource(name); + if (ignoreBase) { + url = (getRootLoader() == null) ? null + : getRootLoader().getResource(name); + } else { + url = (parent == null) ? super.getResource(name) + : parent.getResource(name); + } if (url != null) { log("Resource " + name + " loaded from parent loader", Project.MSG_DEBUG); @@ -953,6 +969,11 @@ if (isParentFirst(name)) { // Normal case. return CollectionUtils.append(base, mine); + } else if (ignoreBase) { + return getRootLoader() == null + ? mine + : CollectionUtils.append( + mine, getRootLoader().getResources(name)); } else { // Inverted. return CollectionUtils.append(mine, base); Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java?view=diff&rev=453032&r1=453031&r2=453032 ============================================================================== --- ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java (original) +++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java Wed Oct 4 14:18:59 2006 @@ -78,7 +78,7 @@ enum2List(acl.getResources(TEST_RESOURCE))); } - public void NottestFindIsolateResources() throws Exception { + public void testFindIsolateResources() throws Exception { String buildTestcases = System.getProperty("build.tests"); assertNotNull("defined ${build.tests}", buildTestcases); assertTrue("have a dir " + buildTestcases, new File(buildTestcases).isDirectory()); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org