servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bsny...@apache.org
Subject svn commit: r634707 - /servicemix/smx3/branches/servicemix-3.2/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
Date Fri, 07 Mar 2008 15:13:05 GMT
Author: bsnyder
Date: Fri Mar  7 07:13:04 2008
New Revision: 634707

URL: http://svn.apache.org/viewvc?rev=634707&view=rev
Log:
SM-1161 - jbi-service-unit causes infinite loop when dependency graph is not cycle-free

Modified:
    servicemix/smx3/branches/servicemix-3.2/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java

Modified: servicemix/smx3/branches/servicemix-3.2/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java?rev=634707&r1=634706&r2=634707&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
Fri Mar  7 07:13:04 2008
@@ -141,10 +141,12 @@
     }
 
     protected Set getArtifacts(Node n, Set s) {
-        s.add(n.getArtifact());
-        for (Iterator iter = n.getChildren().iterator(); iter.hasNext();) {
-            Node c = (Node) iter.next();
-            getArtifacts(c, s);
+        if (!s.contains(n.getArtifact())) {
+            s.add(n.getArtifact());
+            for (Iterator iter = n.getChildren().iterator(); iter.hasNext();) {
+                Node c = (Node) iter.next();
+                getArtifacts(c, s);
+            }
         }
         return s;
     }
@@ -157,11 +159,10 @@
         }
     }
 
-    protected void print(Node rootNode, String string) {
-        getLog().info(string + rootNode.getArtifact());
-        for (Iterator iter = rootNode.getChildren().iterator(); iter.hasNext();) {
-            Node n = (Node) iter.next();
-            print(n, string + "  ");
+    protected void print(Node rootNode) {
+        for (Iterator iter = getArtifacts(rootNode, new HashSet()).iterator(); iter.hasNext();)
{
+            Artifact a = (Artifact) iter.next();
+            getLog().info(" " + a);
         }
     }
 
@@ -223,7 +224,7 @@
         if (getLog().isDebugEnabled()) {
             getLog().debug("Dependency graph");
             getLog().debug("================");
-            print(listener.getRootNode(), "");
+            print(listener.getRootNode());
             getLog().debug("================");
         }
         return listener;



Mime
View raw message