From ivy-commits-return-1840-apmail-incubator-ivy-commits-archive=incubator.apache.org@incubator.apache.org Thu Sep 06 17:07:55 2007 Return-Path: Delivered-To: apmail-incubator-ivy-commits-archive@locus.apache.org Received: (qmail 52228 invoked from network); 6 Sep 2007 17:07:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Sep 2007 17:07:55 -0000 Received: (qmail 70477 invoked by uid 500); 6 Sep 2007 17:07:49 -0000 Delivered-To: apmail-incubator-ivy-commits-archive@incubator.apache.org Received: (qmail 70459 invoked by uid 500); 6 Sep 2007 17:07:49 -0000 Mailing-List: contact ivy-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ivy-dev@incubator.apache.org Delivered-To: mailing list ivy-commits@incubator.apache.org Received: (qmail 70450 invoked by uid 99); 6 Sep 2007 17:07:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 10:07:49 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 17:07:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 087851A9832; Thu, 6 Sep 2007 10:07:34 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r573324 - in /incubator/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/resolver/ test/java/org/apache/ivy/core/resolve/ test/repositories/ test/repositories/1/org9/mod9.2/ivys/ Date: Thu, 06 Sep 2007 17:07:32 -0000 To: ivy-commits@incubator.apache.org From: xavier@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070906170734.087851A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: xavier Date: Thu Sep 6 10:07:31 2007 New Revision: 573324 URL: http://svn.apache.org/viewvc?rev=573324&view=rev Log: FIX: Resolving dynamic version fails when using multiple patterns if only one pattern find a revision and others don't (IVY-602) Added: incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml (with props) incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml (with props) Modified: incubator/ivy/core/trunk/CHANGES.txt incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Modified: incubator/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?rev=573324&r1=573323&r2=573324&view=diff ============================================================================== --- incubator/ivy/core/trunk/CHANGES.txt (original) +++ incubator/ivy/core/trunk/CHANGES.txt Thu Sep 6 10:07:31 2007 @@ -53,6 +53,7 @@ ===================================== - FIX: NullPointerException whilst resolving transitive dependencies (IVY-590) - FIX: cachepath based on a resolve done in a previous build broken (IVY-583) +- FIX: Resolving dynamic version fails when using multiple patterns if only one pattern find a revision and others don't (IVY-602) - IMPROVEMENT: artifactproperty should not overwrite the existing properties (IVY-587) - IMPROVEMENT: Support *(private) and *(public) in the confs parameter of the resolve (IVY-588) Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java?rev=573324&r1=573323&r2=573324&view=diff ============================================================================== --- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java (original) +++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java Thu Sep 6 10:07:31 2007 @@ -84,14 +84,13 @@ protected ResolvedResource findResourceUsingPatterns(ModuleRevisionId moduleRevision, List patternList, Artifact artifact, ResourceMDParser rmdparser, Date date) { - ResolvedResource rres = null; - List resolvedResources = new ArrayList(); boolean dynamic = getSettings().getVersionMatcher().isDynamic(moduleRevision); boolean stop = false; for (Iterator iter = patternList.iterator(); iter.hasNext() && !stop;) { String pattern = (String) iter.next(); - rres = findResourceUsingPattern(moduleRevision, pattern, artifact, rmdparser, date); + ResolvedResource rres = findResourceUsingPattern( + moduleRevision, pattern, artifact, rmdparser, date); if (rres != null) { resolvedResources.add(rres); stop = !dynamic; // stop iterating if we are not searching a dynamic revision @@ -101,11 +100,13 @@ if (resolvedResources.size() > 1) { ResolvedResource[] rress = (ResolvedResource[]) resolvedResources .toArray(new ResolvedResource[resolvedResources.size()]); - rres = findResource(rress, getName(), getLatestStrategy(), getSettings() + return findResource(rress, getName(), getLatestStrategy(), getSettings() .getVersionMatcher(), rmdparser, moduleRevision, date); + } else if (resolvedResources.size() == 1) { + return (ResolvedResource) resolvedResources.get(0); + } else { + return null; } - - return rres; } protected abstract ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=573324&r1=573323&r2=573324&view=diff ============================================================================== --- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original) +++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Thu Sep 6 10:07:31 2007 @@ -2211,6 +2211,24 @@ ModuleRevisionId.newInstance("org1", "mod_released", "1.1")).exists()); } + public void testLatestWithMultiplePatterns() throws Exception { + // The test verify that latest.integration dependencies can be resolved + // when using a resolver with multiple patterns, when only the first pattern + // finds something - test case for IVY-602 + + // mod9.2 depends on latest.integration of mod6.2 + Ivy ivy = Ivy.newInstance(); + ivy.configure(new File("test/repositories/ivysettings-IVY602.xml")); + + ResolveReport report = ivy.resolve(new File( + "test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml").toURL(), + getResolveOptions(new String[] {"default"})); + assertNotNull(report); + assertFalse(report.hasError()); + + assertTrue(getArchiveFileInCache("org6", "mod6.2", "2.0", "mod6.2", "jar", "jar").exists()); + } + public void testVersionRange1() throws Exception { // mod 1.4 depends on mod1.2 [1.0,2.0[ ResolveReport report = ivy.resolve(new File( Added: incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml?rev=573324&view=auto ============================================================================== --- incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml (added) +++ incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml Thu Sep 6 10:07:31 2007 @@ -0,0 +1,29 @@ + + + + + + + Propchange: incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml?rev=573324&view=auto ============================================================================== --- incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml (added) +++ incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml Thu Sep 6 10:07:31 2007 @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml ------------------------------------------------------------------------------ svn:eol-style = native