From 3ca919b9f397b854515ffded1badec1794c11601 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Thu, 14 Sep 2006 03:39:47 +0000 Subject: [PATCH] Updated ConfigurationAction. Removed cron expression validation in execute(). Created method for getting the cron expression. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@443212 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/action/admin/ConfigureAction.java | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java index 51808036b..787606b76 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java @@ -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(); + } + } -- 2.39.5