maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1471472 - /maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
Date Wed, 24 Apr 2013 15:18:33 GMT
Author: hboutemy
Date: Wed Apr 24 15:18:32 2013
New Revision: 1471472

URL: http://svn.apache.org/r1471472
Log:
code simplification

Modified:
    maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java

Modified: maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java?rev=1471472&r1=1471471&r2=1471472&view=diff
==============================================================================
--- maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
(original)
+++ maven/shared/trunk/maven-project-utils/src/main/java/org/apache/maven/shared/project/utils/ProjectUtils.java
Wed Apr 24 15:18:32 2013
@@ -38,26 +38,24 @@ public final class ProjectUtils
      */
     public static boolean isRootProject( MavenProject project )
     {
-        if( project.hasParent() )
+        if ( !project.hasParent() )
         {
-            MavenProject parent = project.getParent();
+            return true;
+        }
+
+        MavenProject parent = project.getParent();
 
-            @SuppressWarnings( "unchecked" )
-            List<MavenProject> collectedProjects = (List<MavenProject>) parent.getCollectedProjects();
-            
-            for( MavenProject collectedProject :  collectedProjects )
+        @SuppressWarnings( "unchecked" )
+        List<MavenProject> collectedProjects = (List<MavenProject>) parent.getCollectedProjects();
+
+        for ( MavenProject collectedProject : collectedProjects )
+        {
+            if ( project.getId().equals( collectedProject.getId() ) )
             {
-                if( project.getId().equals( collectedProject.getId() ) )
-                {
-                    return true;
-                }
+                return true;
             }
-            return false;
-        }
-        else 
-        {
-            return true;
         }
+        return false;
     }
     
     /**
@@ -73,21 +71,18 @@ public final class ProjectUtils
         @SuppressWarnings( "unchecked" )
         List<MavenProject> collectedProjects = (List<MavenProject>) project.getCollectedProjects();
 
-        if( collectedProjects.isEmpty() )
+        if ( collectedProjects.isEmpty() )
         {
             return false;
         }
-        else
+
+        for ( MavenProject collectedProject : collectedProjects )
         {
-            for ( MavenProject collectedProject : collectedProjects )
+            if ( project.getId().equals( collectedProject.getId() ) )
             {
-                if( project.getId().equals( collectedProject.getId() ) )
-                {
-                    return false;
-                }
+                return false;
             }
-            return true;
         }
-        
+        return true;
     }
 }



Mime
View raw message