Author: xavier Date: Sun Dec 2 14:27:19 2007 New Revision: 600395 URL: http://svn.apache.org/viewvc?rev=600395&view=rev Log: FIX: same module appear twice in a circular dependency (IVY-514) (thanks to John Williams) Modified: ant/ivy/core/trunk/CHANGES.txt ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=600395&r1=600394&r2=600395&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Sun Dec 2 14:27:19 2007 @@ -65,7 +65,7 @@ - IMPROVEMENT: Maven Dependency Management is not used to determine artifact version (IVY-616) (thanks to Jim Bonanno) - IMPROVEMENT: split the cache into an downloaded artifacts cache and a metadata cache (IVY-628) - IMPROVEMENT: add publish triggers to event system (IVY-650) (thanks to Jason Trump) -- IMPROVEMENT: Only display unique circular dependencies during Resolve (IVY-653) +- IMPROVEMENT: Only display unique circular dependencies during Resolve (IVY-653 IVY-514) (with contribution from John Williams) - IMPROVEMENT: Adding option 'cp', which makes it possible for main to be loaded from file (IVY-543) (thanks to Tjeerd Verhagen) - IMPROVEMENT: BasicURLHandler should use method=head for getURLInfo (IVY-611) (thanks to Jim Bonanno) - IMPROVEMENT: artifactproperty should not overwrite the existing properties (IVY-587) Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java?rev=600395&r1=600394&r2=600395&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java Sun Dec 2 14:27:19 2007 @@ -17,8 +17,10 @@ */ package org.apache.ivy.plugins.circular; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; import org.apache.ivy.core.module.descriptor.ModuleDescriptor; import org.apache.ivy.core.module.id.ModuleRevisionId; @@ -35,14 +37,21 @@ * * @param descriptors * in order of circular dependency - * @return + * @return a string representation of this circular dependency graph */ public static String formatMessage(final ModuleRevisionId[] mrids) { + Set alreadyAdded = new HashSet(); StringBuffer buff = new StringBuffer(); buff.append(mrids[0]); + alreadyAdded.add(mrids[0]); for (int i = 1; i < mrids.length; i++) { buff.append("->"); - buff.append(mrids[i]); + if (alreadyAdded.add(mrids[i])) { + buff.append(mrids[i]); + } else { + buff.append("..."); + break; + } } return buff.toString(); } Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=600395&r1=600394&r2=600395&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Sun Dec 2 14:27:19 2007 @@ -2458,7 +2458,7 @@ fail("no exception with circular dependency strategy set to error"); } catch (CircularDependencyException ex) { assertEquals( - "org6#mod6.3;1.2->org6#mod6.2;1.1->org6#mod6.3;1.2", ex + "org6#mod6.3;1.2->org6#mod6.2;1.1->...", ex .getMessage()); } }