o Fixed exception handling

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@800493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-03 18:57:21 +00:00
parent b454fb7cb6
commit 64f0e9f57b
3 changed files with 15 additions and 5 deletions

View File

@ -182,7 +182,7 @@ public class DefaultMirrorBuilder
// see if this is a negative match
if ( repo.length() > 1 && repo.startsWith( "!" ) )
{
if ( originalId.equals( repo.substring( 1 ) ) )
if ( repo.substring( 1 ).equals( originalId ) )
{
// explicitly exclude. Set result and stop processing.
result = false;
@ -190,7 +190,7 @@ public class DefaultMirrorBuilder
}
}
// check for exact match
else if ( originalId.equals( repo ) )
else if ( repo.equals( originalId ) )
{
result = true;
break;

View File

@ -57,6 +57,7 @@ import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.util.StringUtils;
/**
* @author Jason van Zyl
@ -564,8 +565,18 @@ public class LegacyRepositorySystem
{
String id = repo.getId();
if ( StringUtils.isEmpty( id ) )
{
throw new InvalidRepositoryException( "Repository identifier missing", "" );
}
String url = repo.getUrl();
if ( StringUtils.isEmpty( url ) )
{
throw new InvalidRepositoryException( "URL missing for repository " + id, id );
}
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );

View File

@ -21,7 +21,6 @@ package org.apache.maven.project;
import java.util.List;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.model.Model;
@ -114,7 +113,7 @@ class DefaultModelBuildingListener
remoteRepositories =
projectBuildingHelper.createArtifactRepositories( model.getRepositories(), remoteRepositories );
}
catch ( InvalidRepositoryException e )
catch ( Exception e )
{
event.getProblems().addError( "Invalid artifact repository: " + e.getMessage(), e );
}
@ -124,7 +123,7 @@ class DefaultModelBuildingListener
pluginRepositories =
projectBuildingHelper.createArtifactRepositories( model.getPluginRepositories(), pluginRepositories );
}
catch ( InvalidRepositoryException e )
catch ( Exception e )
{
event.getProblems().addError( "Invalid plugin repository: " + e.getMessage(), e );
}