[MRM-1632] Invalid Cron in a job means webapp will not start

If syntax is invalid, log a warning instead of throwing the exception, and the
job will not be scheduled.


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1348883 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2012-06-11 14:56:26 +00:00
parent 6f50378e6e
commit ced2e45916
1 changed files with 11 additions and 3 deletions

View File

@ -190,9 +190,17 @@ public class DefaultDownloadRemoteIndexScheduler
{ {
log.info( "schedule download remote index for repository {} with cron expression {}", log.info( "schedule download remote index for repository {} with cron expression {}",
remoteRepository.getId(), remoteRepository.getCronExpression() ); remoteRepository.getId(), remoteRepository.getCronExpression() );
try
{
CronTrigger cronTrigger = new CronTrigger( remoteRepository.getCronExpression() );
taskScheduler.schedule( taskScheduler.schedule(
new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
new CronTrigger( remoteRepository.getCronExpression() ) ); cronTrigger );
}
catch ( IllegalArgumentException e )
{
log.warn( "Unable to schedule remote index download: " + e.getLocalizedMessage() );
}
if ( remoteRepository.isDownloadRemoteIndexOnStartup() ) if ( remoteRepository.isDownloadRemoteIndexOnStartup() )
{ {