be more specific with i18n keys

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@412325 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-06-07 08:33:00 +00:00
parent 85d48bdf93
commit f1f69f4c8a
2 changed files with 18 additions and 11 deletions

View File

@ -264,33 +264,41 @@ public class DefaultRepositoryConverter
private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact, private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact,
ArtifactReporter reporter ) ArtifactReporter reporter )
{ {
String key = "failure.incorrect."; String groupIdKey;
String artifactIdKey = null;
String snapshotKey = null;
String versionKey = null;
String versionsKey = null;
if ( repositoryMetadata.storedInGroupDirectory() ) if ( repositoryMetadata.storedInGroupDirectory() )
{ {
key += "groupMetadata."; groupIdKey = "failure.incorrect.groupMetadata.groupId";
} }
else if ( repositoryMetadata.storedInArtifactVersionDirectory() ) else if ( repositoryMetadata.storedInArtifactVersionDirectory() )
{ {
key += "snapshotMetadata."; groupIdKey = "failure.incorrect.snapshotMetadata.groupId";
artifactIdKey = "failure.incorrect.snapshotMetadata.artifactId";
versionKey = "failure.incorrect.snapshotMetadata.version";
snapshotKey = "failure.incorrect.snapshotMetadata.snapshot";
} }
else else
{ {
key += "artifactMetadata."; groupIdKey = "failure.incorrect.artifactMetadata.groupId";
artifactIdKey = "failure.incorrect.artifactMetadata.artifactId";
versionsKey = "failure.incorrect.artifactMetadata.versions";
} }
boolean result = true; boolean result = true;
if ( !metadata.getGroupId().equals( artifact.getGroupId() ) ) if ( !metadata.getGroupId().equals( artifact.getGroupId() ) )
{ {
reporter.addFailure( artifact, getI18NString( key + "groupId" ) ); reporter.addFailure( artifact, getI18NString( groupIdKey ) );
result = false; result = false;
} }
if ( !repositoryMetadata.storedInGroupDirectory() ) if ( !repositoryMetadata.storedInGroupDirectory() )
{ {
if ( !metadata.getArtifactId().equals( artifact.getArtifactId() ) ) if ( !metadata.getArtifactId().equals( artifact.getArtifactId() ) )
{ {
reporter.addFailure( artifact, getI18NString( key + "artifactId" ) ); reporter.addFailure( artifact, getI18NString( artifactIdKey ) );
result = false; result = false;
} }
if ( !repositoryMetadata.storedInArtifactVersionDirectory() ) if ( !repositoryMetadata.storedInArtifactVersionDirectory() )
@ -313,7 +321,7 @@ public class DefaultRepositoryConverter
if ( !foundVersion ) if ( !foundVersion )
{ {
reporter.addFailure( artifact, getI18NString( key + "versions" ) ); reporter.addFailure( artifact, getI18NString( versionsKey ) );
result = false; result = false;
} }
} }
@ -322,7 +330,7 @@ public class DefaultRepositoryConverter
// snapshot metadata // snapshot metadata
if ( !artifact.getBaseVersion().equals( metadata.getVersion() ) ) if ( !artifact.getBaseVersion().equals( metadata.getVersion() ) )
{ {
reporter.addFailure( artifact, getI18NString( key + "version" ) ); reporter.addFailure( artifact, getI18NString( versionKey ) );
result = false; result = false;
} }
@ -345,7 +353,7 @@ public class DefaultRepositoryConverter
if ( !correct ) if ( !correct )
{ {
reporter.addFailure( artifact, getI18NString( key + "snapshot" ) ); reporter.addFailure( artifact, getI18NString( snapshotKey ) );
result = false; result = false;
} }
} }

View File

@ -23,7 +23,6 @@ warning.missing.pom=The artifact had no POM in the source repository.
exception.repositories.match=Source and target repositories are identical. exception.repositories.match=Source and target repositories are identical.
# TODO! update definitions
failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect. failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.
failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect. failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.