]> source.dussan.org Git - archiva.git/commitdiff
Updated ConfigurationAction. Removed cron expression validation in execute(). Created...
authorMaria Odea B. Ching <oching@apache.org>
Thu, 14 Sep 2006 03:39:47 +0000 (03:39 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Thu, 14 Sep 2006 03:39:47 +0000 (03:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@443212 13f79535-47bb-0310-9956-ffa450edef68

archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java

index 51808036bed738a152f0f27284b31413b42e847e..787606b76d4577911bfb349471799295483e2c8b 100644 (file)
@@ -67,17 +67,12 @@ public class ConfigureAction
 
     private String year;
 
-    private String cronEx = "";
-
     public void validate()
     {
-        cronEx = ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month +
-                    " " + dayOfWeek + " " + year ).trim();
-
         //validate cron expression
         cronValidator = new CronExpressionValidator();
 
-        if( !cronValidator.validate( cronEx ) )
+        if( !cronValidator.validate( getCronExpression() ) )
         {
             addActionError( "Invalid Cron Expression" );
         }              
@@ -89,19 +84,7 @@ public class ConfigureAction
     {
         // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
         // TODO: if this is changed, do we move the index or recreate it?
-
-        String cronEx = ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month +
-            " " + dayOfWeek + " " + year ).trim();
-
-        //validate cron expression
-        cronValidator = new CronExpressionValidator();
-        if( !cronValidator.validate( cronEx ) )
-        {
-            addActionError( "Invalid Cron Expression" );
-            return ERROR;
-        }
-
-        configuration.setIndexerCronExpression( cronEx );
+        configuration.setIndexerCronExpression( getCronExpression() );
 
         // Normalize the path
         File file = new File( configuration.getIndexPath() );
@@ -227,4 +210,11 @@ public class ConfigureAction
     {
         this.dayOfWeek = dayOfWeek;
     }
+
+    private String getCronExpression()
+    {
+        return ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month +
+                    " " + dayOfWeek + " " + year ).trim();
+    }
+
 }