From 29be609adb8377a6535926fc33c9f5906a4ec696 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Mon, 17 Sep 2007 15:27:39 +0000
Subject: [PATCH] This commit is for supporting of task scheduling in the future (right now tasks can only be scheduled to start immediately) for tasks that support scheduling.  Start time is specified by including -t/--startTime along with a date string of format 'YYYYMMDDhhmmss'.

---
 opends/src/server/org/opends/server/tools/StopDS.java |   37 ++++++-------------------------------
 1 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/StopDS.java b/opends/src/server/org/opends/server/tools/StopDS.java
index 687b44d..aa10827 100644
--- a/opends/src/server/org/opends/server/tools/StopDS.java
+++ b/opends/src/server/org/opends/server/tools/StopDS.java
@@ -480,40 +480,15 @@
     if (stopTimeStr.isPresent())
     {
       String timeStr = stopTimeStr.getValue();
-      if (timeStr.endsWith("Z"))
+      try
       {
-        SimpleDateFormat dateFormat =
-            new SimpleDateFormat(DATE_FORMAT_GENERALIZED_TIME);
-        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
-        dateFormat.setLenient(true);
-
-        try
-        {
-          stopTime = dateFormat.parse(timeStr);
-        }
-        catch (Exception e)
-        {
-          Message message = ERR_STOPDS_CANNOT_DECODE_STOP_TIME.get();
-          err.println(wrapText(message, MAX_LINE_WIDTH));
-          return LDAPResultCode.CLIENT_SIDE_PARAM_ERROR;
-        }
+        stopTime = parseDateTimeString(timeStr);
       }
-      else
+      catch (Exception e)
       {
-        SimpleDateFormat dateFormat =
-            new SimpleDateFormat(DATE_FORMAT_COMPACT_LOCAL_TIME);
-        dateFormat.setLenient(true);
-
-        try
-        {
-          stopTime = dateFormat.parse(timeStr);
-        }
-        catch (Exception e)
-        {
-          Message message = ERR_STOPDS_CANNOT_DECODE_STOP_TIME.get();
-          err.println(wrapText(message, MAX_LINE_WIDTH));
-          return LDAPResultCode.CLIENT_SIDE_PARAM_ERROR;
-        }
+        Message message = ERR_STOPDS_CANNOT_DECODE_STOP_TIME.get();
+        err.println(wrapText(message, MAX_LINE_WIDTH));
+        return LDAPResultCode.CLIENT_SIDE_PARAM_ERROR;
       }
     }
 

--
Gitblit v1.10.0