diff options
author | Olivier Lamy <olamy@apache.org> | 2011-09-01 16:43:14 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-09-01 16:43:14 +0000 |
commit | 3629e72ab38da7bdaa68b1999ee942319869a48c (patch) | |
tree | b2d4d23497a31af5b0a25b73c8faccbc95160bf3 /archiva-modules/archiva-base | |
parent | e6ce81d425e454f082ff37c547503c07233ab68e (diff) | |
download | archiva-3629e72ab38da7bdaa68b1999ee942319869a48c.tar.gz archiva-3629e72ab38da7bdaa68b1999ee942319869a48c.zip |
throw exception when id or cron expression are empty
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1164154 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
2 files changed, 12 insertions, 1 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index bc5d0cf9e..992987e53 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -181,8 +181,15 @@ public class DefaultManagedRepositoryAdmin throw new RepositoryAdminException( "Invalid cron expression." ); } } + else + { + throw new RepositoryAdminException( "Cron expression cannot be empty." ); + } - // FIXME checkId non empty + if (StringUtils.isBlank( repoId )) + { + throw new RepositoryAdminException( "Repository ID cannot be empty." ); + } if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) ) { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java index 551572612..a5eedb46f 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java @@ -100,6 +100,7 @@ public class ManagedRepositoryAdminTest repo.setId( repoId ); repo.setName( "test repo" ); repo.setLocation( repoLocation ); + repo.setCronExpression( "0 0 * * * ?" ); managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() ); repos = managedRepositoryAdmin.getManagedRepositories(); assertNotNull( repos ); @@ -147,6 +148,7 @@ public class ManagedRepositoryAdminTest repo.setId( repoId ); repo.setName( "test repo" ); repo.setLocation( repoLocation ); + repo.setCronExpression( "0 0 * * * ?" ); managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() ); assertTemplateRoleExists( repoId ); @@ -160,6 +162,7 @@ public class ManagedRepositoryAdminTest repo.setName( newName ); repo.setLocation( repoLocation ); + repo.setCronExpression( "0 0 * * * ?" ); managedRepositoryAdmin.updateManagedRepository( repo, false, getFakeAuditInformation(), false ); @@ -204,6 +207,7 @@ public class ManagedRepositoryAdminTest repo.setId( repoId ); repo.setName( "test repo" ); repo.setLocation( repoLocation ); + repo.setCronExpression( "0 0 * * * ?" ); managedRepositoryAdmin.addManagedRepository( repo, true, getFakeAuditInformation() ); repos = managedRepositoryAdmin.getManagedRepositories(); assertNotNull( repos ); |