aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 );