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
This commit is contained in:
Brett Porter 2007-02-14 13:43:26 +00:00
parent c7e88912eb
commit 19987e6e17
2 changed files with 38 additions and 32 deletions

View 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;
}

View 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;
}