]> source.dussan.org Git - archiva.git/commitdiff
only scan if the repository actually exists (it may not have been created yet)
authorBrett Porter <brett@apache.org>
Wed, 14 Feb 2007 13:43:26 +0000 (13:43 +0000)
committerBrett Porter <brett@apache.org>
Wed, 14 Feb 2007 13:43:26 +0000 (13:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@507529 13f79535-47bb-0310-9956-ffa450edef68

archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/AbstractArtifactDiscoverer.java
archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultMetadataDiscoverer.java

index 0f4b7bfdea038bafaf4d19d37afd7f55d9a73149..f3002ec53536928f37f029d1a851284a564664aa 100644 (file)
@@ -63,31 +63,33 @@ public abstract class AbstractArtifactDiscoverer
 
         List artifacts = new ArrayList();
 
-        List artifactPaths = scanForArtifactPaths( repositoryBase, blacklistedPatterns );
-
-        for ( Iterator i = artifactPaths.iterator(); i.hasNext(); )
+        if ( repositoryBase.exists() )
         {
-            String path = (String) i.next();
+            List artifactPaths = scanForArtifactPaths( repositoryBase, blacklistedPatterns );
 
-            try
+            for ( Iterator i = artifactPaths.iterator(); i.hasNext(); )
             {
-                Artifact artifact = buildArtifactFromPath( path, repository );
-
-                if ( filter.include( artifact ) )
+                String path = (String) i.next();
+    
+                try
                 {
-                    artifacts.add( artifact );
+                    Artifact artifact = buildArtifactFromPath( path, repository );
+    
+                    if ( filter.include( artifact ) )
+                    {
+                        artifacts.add( artifact );
+                    }
+                    else
+                    {
+                        addExcludedPath( path, "Omitted by filter" );
+                    }
                 }
-                else
+                catch ( DiscovererException e )
                 {
-                    addExcludedPath( path, "Omitted by filter" );
+                    addKickedOutPath( path, e.getMessage() );
                 }
             }
-            catch ( DiscovererException e )
-            {
-                addKickedOutPath( path, e.getMessage() );
-            }
         }
-
         return artifacts;
     }
 
index dd18c5da361ec4b13581b66c8987cb21d305befd..f97972381f1487d5f4ffd3fe1b94826090aba6f3 100644 (file)
@@ -69,31 +69,35 @@ public class DefaultMetadataDiscoverer
         }
 
         List metadataFiles = new ArrayList();
-        List metadataPaths = scanForArtifactPaths( new File( repository.getBasedir() ), blacklistedPatterns,
-                                                   STANDARD_DISCOVERY_INCLUDES, null );
 
-        for ( Iterator i = metadataPaths.iterator(); i.hasNext(); )
+        File repositoryBase = new File( repository.getBasedir() );
+        if ( repositoryBase.exists() )
         {
-            String metadataPath = (String) i.next();
-            try
+            List metadataPaths = scanForArtifactPaths( repositoryBase, blacklistedPatterns,
+                                                       STANDARD_DISCOVERY_INCLUDES, null );
+
+            for ( Iterator i = metadataPaths.iterator(); i.hasNext(); )
             {
-                RepositoryMetadata metadata = buildMetadata( repository.getBasedir(), metadataPath );
-                File f = new File( repository.getBasedir(), metadataPath );
-                if ( filter.include( metadata, f.lastModified() ) )
+                String metadataPath = (String) i.next();
+                try
                 {
-                    metadataFiles.add( metadata );
+                    RepositoryMetadata metadata = buildMetadata( repository.getBasedir(), metadataPath );
+                    File f = new File( repository.getBasedir(), metadataPath );
+                    if ( filter.include( metadata, f.lastModified() ) )
+                    {
+                        metadataFiles.add( metadata );
+                    }
+                    else
+                    {
+                        addExcludedPath( metadataPath, "Metadata excluded by filter" );
+                    }
                 }
-                else
+                catch ( DiscovererException e )
                 {
-                    addExcludedPath( metadataPath, "Metadata excluded by filter" );
+                    addKickedOutPath( metadataPath, e.getMessage() );
                 }
             }
-            catch ( DiscovererException e )
-            {
-                addKickedOutPath( metadataPath, e.getMessage() );
-            }
         }
-
         return metadataFiles;
     }