]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1632] Invalid Cron in a job means webapp will not start
authorBrett Porter <brett@apache.org>
Mon, 11 Jun 2012 14:56:26 +0000 (14:56 +0000)
committerBrett Porter <brett@apache.org>
Mon, 11 Jun 2012 14:56:26 +0000 (14:56 +0000)
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

archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java

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