diff options
author | Maria Odea B. Ching <oching@apache.org> | 2008-05-23 06:18:36 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2008-05-23 06:18:36 +0000 |
commit | a83e5b52a9c66417c4a68da34dcf10fedba5d6cb (patch) | |
tree | a6c684e4acdf9aa2a7e28311987748dee148ec14 | |
parent | 8b7e75cc71f80852c95d8c457165cd8b82a56e46 (diff) | |
download | archiva-a83e5b52a9c66417c4a68da34dcf10fedba5d6cb.tar.gz archiva-a83e5b52a9c66417c4a68da34dcf10fedba5d6cb.zip |
[MRM-694]
-add validation check for existing ids for repo groups and remote & managed repos
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@659443 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 24 insertions, 2 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java index 74a6d5b91..6d5a0bb7b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java @@ -104,7 +104,12 @@ public class AddManagedRepositoryAction addFieldError( "repository.id", "Unable to add new repository with id [" + repoId + "], that id already exists as a remote repository." ); } - + else if( config.getRepositoryGroupsAsMap().containsKey( repoId ) ) + { + addFieldError( "repository.id", "Unable to add new repository with id [" + repoId + + "], that id already exists as a repository group." ); + } + if ( !validator.validate( repository.getRefreshCronExpression() ) ) { addFieldError( "repository.refreshCronExpression", "Invalid cron expression." ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java index bcf517624..80d67582c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java @@ -100,6 +100,11 @@ public class AddRemoteRepositoryAction addFieldError( "repository.id", "Unable to add new repository with id [" + repoId + "], that id already exists as a remote repository." ); } + else if( config.getRepositoryGroupsAsMap().containsKey( repoId ) ) + { + addFieldError( "repository.id", "Unable to add new repository with id [" + repoId + + "], that id already exists as a repository group." ); + } } public RemoteRepositoryConfiguration getRepository() diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java index d01cc9b98..9a4f3d134 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java @@ -93,7 +93,19 @@ public class RepositoryGroupsAction if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) ) { addActionError( "Unable to add new repository group with id [" + repoGroupId - + "], that id already exists." ); + + "], that id already exists as a repository group." ); + return ERROR; + } + else if ( configuration.getManagedRepositoriesAsMap().containsKey( repoGroupId ) ) + { + addActionError( "Unable to add new repository group with id [" + repoGroupId + + "], that id already exists as a managed repository." ); + return ERROR; + } + else if ( configuration.getRemoteRepositoriesAsMap().containsKey( repoGroupId ) ) + { + addActionError( "Unable to add new repository group with id [" + repoGroupId + + "], that id already exists as a remote repository." ); return ERROR; } |