maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1098181 - /maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
Date Sat, 30 Apr 2011 22:52:07 GMT
Author: hboutemy
Date: Sat Apr 30 22:52:06 2011
New Revision: 1098181

URL: http://svn.apache.org/viewvc?rev=1098181&view=rev
Log:
code simplification

Modified:
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java?rev=1098181&r1=1098180&r2=1098181&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
(original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
Sat Apr 30 22:52:06 2011
@@ -156,29 +156,8 @@ public class Dependencies
         }
 
         allDependencies = new ArrayList<Artifact>();
-        for ( @SuppressWarnings( "unchecked" )
-        Iterator<DependencyNode> i = dependencyTreeNode.getChildren().iterator(); i.hasNext();
)
-        {
-            DependencyNode dependencyNode = i.next();
 
-            if ( dependencyNode.getState() != DependencyNode.INCLUDED )
-            {
-                continue;
-            }
-
-            if ( dependencyNode.getArtifact().getGroupId().equals( project.getGroupId() )
-                && dependencyNode.getArtifact().getArtifactId().equals( project.getArtifactId()
)
-                && dependencyNode.getArtifact().getVersion().equals( project.getVersion()
) )
-            {
-                continue;
-            }
-
-            if ( !allDependencies.contains( dependencyNode.getArtifact() ) )
-            {
-                allDependencies.add( dependencyNode.getArtifact() );
-            }
-            getAllDependencies( dependencyNode );
-        }
+        addAllChildrenDependencies( dependencyTreeNode );
 
         return allDependencies;
     }
@@ -287,17 +266,8 @@ public class Dependencies
      *
      * @param dependencyNode not null
      */
-    private void getAllDependencies( DependencyNode dependencyNode )
+    private void addAllChildrenDependencies( DependencyNode dependencyNode )
     {
-        if ( dependencyNode == null || dependencyNode.getChildren() == null )
-        {
-            if ( !allDependencies.contains( dependencyNode.getArtifact() ) )
-            {
-                allDependencies.add( dependencyNode.getArtifact() );
-            }
-            return;
-        }
-
         for ( @SuppressWarnings( "unchecked" )
         Iterator<DependencyNode> i = dependencyNode.getChildren().iterator(); i.hasNext();
)
         {
@@ -308,18 +278,22 @@ public class Dependencies
                 continue;
             }
 
-            if ( subdependencyNode.getArtifact().getGroupId().equals( project.getGroupId()
)
-                && subdependencyNode.getArtifact().getArtifactId().equals( project.getArtifactId()
)
-                && subdependencyNode.getArtifact().getVersion().equals( project.getVersion()
) )
+            Artifact artifact = subdependencyNode.getArtifact();
+
+            if ( artifact.getGroupId().equals( project.getGroupId() )
+                && artifact.getArtifactId().equals( project.getArtifactId() )
+                && artifact.getVersion().equals( project.getVersion() ) )
             {
                 continue;
             }
 
-            if ( !allDependencies.contains( subdependencyNode.getArtifact() ) )
+            if ( !allDependencies.contains( artifact ) )
             {
-                allDependencies.add( subdependencyNode.getArtifact() );
+                allDependencies.add( artifact );
             }
-            getAllDependencies( subdependencyNode );
+
+            addAllChildrenDependencies( subdependencyNode );
         }
+
     }
 }



Mime
View raw message