summaryrefslogtreecommitdiffstats
path: root/archiva-discoverer
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2007-02-14 13:43:26 +0000
committerBrett Porter <brett@apache.org>2007-02-14 13:43:26 +0000
commit19987e6e17e3271dcf08647bd845219d1956d74e (patch)
tree96f91c364ebb23b9dc1c51bc91e19f7aa435b7e2 /archiva-discoverer
parentc7e88912eb4a449f525a2e7d9f61029ac1598767 (diff)
downloadarchiva-19987e6e17e3271dcf08647bd845219d1956d74e.tar.gz
archiva-19987e6e17e3271dcf08647bd845219d1956d74e.zip
only scan if the repository actually exists (it may not have been created yet)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@507529 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-discoverer')
-rw-r--r--archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/AbstractArtifactDiscoverer.java34
-rw-r--r--archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultMetadataDiscoverer.java36
2 files changed, 38 insertions, 32 deletions
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/AbstractArtifactDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/AbstractArtifactDiscoverer.java
index 0f4b7bfde..f3002ec53 100644
--- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/AbstractArtifactDiscoverer.java
+++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/AbstractArtifactDiscoverer.java
@@ -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;
}
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultMetadataDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultMetadataDiscoverer.java
index dd18c5da3..f97972381 100644
--- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultMetadataDiscoverer.java
+++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultMetadataDiscoverer.java
@@ -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;
}