You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2014/05/25 00:00:37 UTC

git commit: fixed errors reported by Checkstyle

Repository: maven
Updated Branches:
  refs/heads/master 3729324a1 -> 73d35ba95


fixed errors reported by Checkstyle

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/73d35ba9
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/73d35ba9
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/73d35ba9

Branch: refs/heads/master
Commit: 73d35ba9597cd867717310ae8813376888debb9b
Parents: 3729324
Author: Hervé Boutemy <hb...@apache.org>
Authored: Sun May 25 00:00:26 2014 +0200
Committer: Hervé Boutemy <hb...@apache.org>
Committed: Sun May 25 00:00:26 2014 +0200

----------------------------------------------------------------------
 .../maven/DefaultProjectDependencyGraph.java    |   7 +-
 .../artifact/InvalidRepositoryException.java    |   2 +-
 .../DefaultMavenExecutionRequestPopulator.java  |   7 +-
 .../maven/execution/MavenExecutionRequest.java  |   4 +-
 .../DefaultLifecycleTaskSegmentCalculator.java  |   7 +-
 .../lifecycle/internal/ExecutionPlanItem.java   |   1 -
 .../LifecycleTaskSegmentCalculator.java         |   2 +-
 .../maven/plugin/ExtensionRealmCache.java       |   2 +-
 .../maven/plugin/PluginArtifactsCache.java      |   2 +-
 .../apache/maven/plugin/PluginRealmCache.java   |   2 +-
 .../DefaultPluginDependenciesResolver.java      |   2 +-
 .../org/apache/maven/project/MavenProject.java  | 133 ++++++++-----------
 .../apache/maven/project/ProjectRealmCache.java |   2 +-
 .../project/artifact/MavenMetadataSource.java   |  10 +-
 14 files changed, 73 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/DefaultProjectDependencyGraph.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/DefaultProjectDependencyGraph.java b/maven-core/src/main/java/org/apache/maven/DefaultProjectDependencyGraph.java
index adf85da..84d2cc5 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultProjectDependencyGraph.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultProjectDependencyGraph.java
@@ -76,12 +76,9 @@ class DefaultProjectDependencyGraph
     {
         for ( String id : sorter.getDependents( projectId ) )
         {
-            if ( projectIds.add( id ) )
+            if ( projectIds.add( id ) && transitive )
             {
-                if ( transitive )
-                {
-                    getDownstreamProjects( id, projectIds, transitive );
-                }
+                getDownstreamProjects( id, projectIds, transitive );
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java b/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
index e3538c3..62991f1 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
@@ -48,7 +48,7 @@ public class InvalidRepositoryException
     @Deprecated
     public InvalidRepositoryException( String message, Throwable t )
     {
-        super( message );
+        super( message, t );
         this.repositoryId = null;
     }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
index 1e103e9..1feebab 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
@@ -242,12 +242,9 @@ public class DefaultMavenExecutionRequestPopulator
 
     private void baseDirectory( MavenExecutionRequest request )
     {
-        if ( request.getBaseDirectory() == null )
+        if ( request.getBaseDirectory() == null && request.getPom() != null )
         {
-            if ( request.getPom() != null )
-            {
-                request.setBaseDirectory( request.getPom().getAbsoluteFile().getParentFile() );
-            }
+            request.setBaseDirectory( request.getPom().getAbsoluteFile().getParentFile() );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
index 121e51a..dfa20c4 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
@@ -177,12 +177,12 @@ public interface MavenExecutionRequest
      * 
      * @param degreeOfConcurrency
      */
-    public void setDegreeOfConcurrency( final int degreeOfConcurrency );
+    void setDegreeOfConcurrency( int degreeOfConcurrency );
 
     /**
      * @return the degree of concurrency for the build.
      */
-    public int getDegreeOfConcurrency();
+    int getDegreeOfConcurrency();
 
     // Recursive (really to just process the top-level POM)
     MavenExecutionRequest setRecursive( boolean recursive );

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java
index 95a0fe6..575292b 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java
@@ -75,12 +75,9 @@ public class DefaultLifecycleTaskSegmentCalculator
 
         List<String> tasks = session.getGoals();
 
-        if ( tasks == null || tasks.isEmpty() )
+        if ( ( tasks == null || tasks.isEmpty() ) && !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
         {
-            if ( !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
-            {
-                tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
-            }
+            tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
         }
 
         return calculateTaskSegments( session, tasks );

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java
index 4b85aa3..6ecc3e3 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java
@@ -27,7 +27,6 @@ import org.apache.maven.project.MavenProject;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.CountDownLatch;
 
 /**
  * Wraps individual MojoExecutions, containing information about completion status and scheduling.

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
index 113a5ab..6fe7e58 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
@@ -51,7 +51,7 @@ public interface LifecycleTaskSegmentCalculator
         MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
         PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException;
 
-    public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
+    List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
         throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
         MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
         PluginVersionResolutionException;

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java b/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java
index cf5db3e..560e454 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java
@@ -37,7 +37,7 @@ import org.eclipse.aether.artifact.Artifact;
 public interface ExtensionRealmCache
 {
 
-    public static class CacheRecord
+    static class CacheRecord
     {
 
         public final ClassRealm realm;

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java
index df07d4c..fe0ef15 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java
@@ -47,7 +47,7 @@ public interface PluginArtifactsCache
         // marker interface for cache keys
     }
 
-    public static class CacheRecord
+    static class CacheRecord
     {
 
         public final List<Artifact> artifacts;

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
index 7c04ed5..11e981b 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
@@ -41,7 +41,7 @@ import org.eclipse.aether.repository.RemoteRepository;
 public interface PluginRealmCache
 {
 
-    public static class CacheRecord
+    static class CacheRecord
     {
         public final ClassRealm realm;
 

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
index 8153aed..a1b735e 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
@@ -224,7 +224,7 @@ public class DefaultPluginDependenciesResolver
             org.eclipse.aether.graph.Dependency dep = node.getDependency();
             if ( dep != null )
             {
-                org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
+                Artifact art = dep.getArtifact();
 
                 buffer.append( art );
                 buffer.append( ':' ).append( dep.getScope() );

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
index 91038b3..0e83e40 100644
--- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
+++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
@@ -71,7 +71,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -486,12 +485,9 @@ public class MavenProject
         if ( path != null )
         {
             path = path.trim();
-            if ( path.length() != 0 )
+            if ( path.length() != 0 && !getScriptSourceRoots().contains( path ) )
             {
-                if ( !getScriptSourceRoots().contains( path ) )
-                {
-                    getScriptSourceRoots().add( path );
-                }
+                getScriptSourceRoots().add( path );
             }
         }
     }
@@ -529,13 +525,11 @@ public class MavenProject
 
         for ( Artifact a : getArtifacts() )
         {                        
-            if ( a.getArtifactHandler().isAddedToClasspath() )
+            if ( a.getArtifactHandler().isAddedToClasspath()
+            // TODO: let the scope handler deal with this
+                && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) )
             {
-                // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
-                {
-                    addArtifactPath( a, list );
-                }
+                addArtifactPath( a, list );
             }
         }
 
@@ -550,13 +544,11 @@ public class MavenProject
         for ( Artifact a : getArtifacts() )
         {
             // TODO: classpath check doesn't belong here - that's the other method
-            if ( a.getArtifactHandler().isAddedToClasspath() )
+            if ( a.getArtifactHandler().isAddedToClasspath()
+            // TODO: let the scope handler deal with this
+                && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) )
             {
-                // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
-                {
-                    list.add( a );
-                }
+                list.add( a );
             }
         }
         return list;
@@ -681,13 +673,11 @@ public class MavenProject
 
         for ( Artifact a : getArtifacts() )
         {
-            if ( a.getArtifactHandler().isAddedToClasspath() )
+            if ( a.getArtifactHandler().isAddedToClasspath()
+            // TODO: let the scope handler deal with this
+                && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
             {
-                // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
-                {
-                    addArtifactPath( a, list );
-                }
+                addArtifactPath( a, list );
             }
         }
         return list;
@@ -701,13 +691,11 @@ public class MavenProject
         for ( Artifact a : getArtifacts()  )
         {
             // TODO: classpath check doesn't belong here - that's the other method
-            if ( a.getArtifactHandler().isAddedToClasspath() )
+            if ( a.getArtifactHandler().isAddedToClasspath()
+            // TODO: let the scope handler deal with this
+                && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
             {
-                // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
-                {
-                    list.add( a );
-                }
+                list.add( a );
             }
         }
         return list;
@@ -758,13 +746,11 @@ public class MavenProject
 
         for ( Artifact a : getArtifacts() )
         {
-            if ( a.getArtifactHandler().isAddedToClasspath() )
+            if ( a.getArtifactHandler().isAddedToClasspath()
+            // TODO: let the scope handler deal with this
+                && Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
             {
-                // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
-                {
-                    addArtifactPath( a, list );
-                }
+                addArtifactPath( a, list );
             }
         }
         return list;
@@ -778,13 +764,11 @@ public class MavenProject
         for ( Artifact a : getArtifacts()  )
         {
             // TODO: classpath check doesn't belong here - that's the other method
-            if ( a.getArtifactHandler().isAddedToClasspath() )
+            if ( a.getArtifactHandler().isAddedToClasspath()
+            // TODO: let the scope handler deal with this
+                && Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
             {
-                // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
-                {
-                    list.add( a );
-                }
+                list.add( a );
             }
         }
         return list;
@@ -1892,26 +1876,22 @@ public class MavenProject
 
     protected ArtifactRepository getReleaseArtifactRepository()
     {
-        if ( releaseArtifactRepository == null )
+        if ( releaseArtifactRepository == null && getDistributionManagement() != null
+            && getDistributionManagement().getRepository() != null )
         {
-            if ( getDistributionManagement() != null && getDistributionManagement().getRepository() != null )
+            checkProjectBuildingRequest();
+            try
             {
-                checkProjectBuildingRequest();
-                try
-                {
-                    ArtifactRepository repo =
-                        repositorySystem.buildArtifactRepository( getDistributionManagement().getRepository() );
-                    repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(),
-                                                  Arrays.asList( repo ) );
-                    repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
-                                                           Arrays.asList( repo ) );
-                    setReleaseArtifactRepository( repo );
-                }
-                catch ( InvalidRepositoryException e )
-                {
-                    throw new IllegalStateException( "Failed to create release distribution repository for " + getId(),
-                                                     e );
-                }
+                ArtifactRepository repo =
+                    repositorySystem.buildArtifactRepository( getDistributionManagement().getRepository() );
+                repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
+                repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
+                                                       Arrays.asList( repo ) );
+                setReleaseArtifactRepository( repo );
+            }
+            catch ( InvalidRepositoryException e )
+            {
+                throw new IllegalStateException( "Failed to create release distribution repository for " + getId(), e );
             }
         }
 
@@ -1920,27 +1900,22 @@ public class MavenProject
 
     protected ArtifactRepository getSnapshotArtifactRepository()
     {
-        if ( snapshotArtifactRepository == null )
+        if ( snapshotArtifactRepository == null && getDistributionManagement() != null
+            && getDistributionManagement().getSnapshotRepository() != null )
         {
-            if ( getDistributionManagement() != null && getDistributionManagement().getSnapshotRepository() != null )
+            checkProjectBuildingRequest();
+            try
             {
-                checkProjectBuildingRequest();
-                try
-                {
-                    ArtifactRepository repo =
-                        repositorySystem.buildArtifactRepository( getDistributionManagement().getSnapshotRepository() );
-                    repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(),
-                                                  Arrays.asList( repo ) );
-                    repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
-                                                           Arrays.asList( repo ) );
-                    setSnapshotArtifactRepository( repo );
-                }
-                catch ( InvalidRepositoryException e )
-                {
-                    throw new IllegalStateException(
-                                                     "Failed to create snapshot distribution repository for " + getId(),
-                                                     e );
-                }
+                ArtifactRepository repo =
+                    repositorySystem.buildArtifactRepository( getDistributionManagement().getSnapshotRepository() );
+                repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
+                repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
+                                                       Arrays.asList( repo ) );
+                setSnapshotArtifactRepository( repo );
+            }
+            catch ( InvalidRepositoryException e )
+            {
+                throw new IllegalStateException( "Failed to create snapshot distribution repository for " + getId(), e );
             }
         }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java b/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
index 456cfa9..415eab9 100644
--- a/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
+++ b/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
@@ -35,7 +35,7 @@ import org.eclipse.aether.graph.DependencyFilter;
 public interface ProjectRealmCache
 {
 
-    public static class CacheRecord
+    static class CacheRecord
     {
 
         public final ClassRealm realm;

http://git-wip-us.apache.org/repos/asf/maven/blob/73d35ba9/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
index 002134b..f2fc322 100644
--- a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
@@ -157,13 +157,11 @@ public class MavenMetadataSource
             cache.get( artifact, request.isResolveManagedVersions(), request.getLocalRepository(),
                        request.getRemoteRepositories() );
 
-        if ( cached != null )
+        if ( cached != null
+        // if the POM has no file, we cached a missing artifact, only return the cached data if no update forced
+            && ( !request.isForceUpdate() || hasFile( cached.getPomArtifact() ) ) )
         {
-            // if the POM has no file, we cached a missing artifact, only return the cached data if no update forced
-            if ( !request.isForceUpdate() || hasFile( cached.getPomArtifact() ) )
-            {
-                return cached;
-            }
+            return cached;
         }
 
         List<Dependency> dependencies;