[MNG-5157] NPE stemming from DefaultModelBuilder.containsCoordinates

o Revised original fix to prevent duplicate emission of error msg

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1176402 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2011-09-27 14:37:20 +00:00
parent a6b7bc895f
commit a1d64e71ca
2 changed files with 12 additions and 6 deletions

View File

@ -909,6 +909,18 @@ public class DefaultModelBuilder
String artifactId = dependency.getArtifactId();
String version = dependency.getVersion();
if ( groupId == null || groupId.length() <= 0 )
{
problems.add( Severity.ERROR, "'dependencyManagement.dependencies.dependency.groupId' for "
+ dependency.getManagementKey() + " is missing.", dependency.getLocation( "" ), null );
continue;
}
if ( artifactId == null || artifactId.length() <= 0 )
{
problems.add( Severity.ERROR, "'dependencyManagement.dependencies.dependency.artifactId' for "
+ dependency.getManagementKey() + " is missing.", dependency.getLocation( "" ), null );
continue;
}
if ( version == null || version.length() <= 0 )
{
problems.add( Severity.ERROR, "'dependencyManagement.dependencies.dependency.version' for "

View File

@ -356,12 +356,6 @@ public class DefaultModelValidator
{
String key = dependency.getManagementKey();
validateStringNotEmpty( prefix + ".groupId", problems, Severity.ERROR, dependency.getGroupId(), key,
dependency );
validateStringNotEmpty( prefix + ".artifactId", problems, Severity.ERROR, dependency.getArtifactId(), key,
dependency );
if ( "import".equals( dependency.getScope() ) )
{
if ( !"pom".equals( dependency.getType() ) )