You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by bs...@apache.org on 2008/03/07 16:22:48 UTC

svn commit: r634714 - /servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java

Author: bsnyder
Date: Fri Mar  7 07:22:47 2008
New Revision: 634714

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

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

Modified: servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java?rev=634714&r1=634713&r2=634714&view=diff
==============================================================================
--- servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java (original)
+++ servicemix/smx3/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java Fri Mar  7 07:22:47 2008
@@ -149,10 +149,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;
     }
@@ -165,11 +167,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);
         }
     }
 
@@ -231,7 +232,7 @@
         if (getLog().isDebugEnabled()) {
             getLog().debug("Dependency graph");
             getLog().debug("================");
-            print(listener.getRootNode(), "");
+            print(listener.getRootNode());
             getLog().debug("================");
         }
         return listener;