summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-09-01 16:43:14 +0000
committerOlivier Lamy <olamy@apache.org>2011-09-01 16:43:14 +0000
commit3629e72ab38da7bdaa68b1999ee942319869a48c (patch)
treeb2d4d23497a31af5b0a25b73c8faccbc95160bf3 /archiva-modules/archiva-base
parente6ce81d425e454f082ff37c547503c07233ab68e (diff)
downloadarchiva-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')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java9
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java4
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 );