From 5eb4ee3a50c6ed6b3c38a2ce37e116768a357ebf Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 13 Feb 2008 09:32:05 +0000
Subject: [PATCH] Fix for issue 2652 (stop-ds should provide the -t 0 option)

---
 opendj-sdk/opends/src/messages/messages/tools.properties         |   10 +++++++---
 opendj-sdk/opends/src/server/org/opends/server/tools/StopDS.java |   20 ++++++++++++--------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/tools.properties b/opendj-sdk/opends/src/messages/messages/tools.properties
index c58604e..4ad4c53 100644
--- a/opendj-sdk/opends/src/messages/messages/tools.properties
+++ b/opendj-sdk/opends/src/messages/messages/tools.properties
@@ -667,8 +667,12 @@
  control with the given authorization ID
 INFO_STOPDS_DESCRIPTION_STOP_REASON_383=Reason the server is being stopped or \
  restarted
-INFO_STOPDS_DESCRIPTION_STOP_TIME_384=Time to begin the shutdown in \
- YYYYMMDDhhmmss format (local time)
+INFO_STOPDS_DESCRIPTION_STOP_TIME_384=Indicates the date/time at which the \
+ shutdown operation will begin as a server task expressed in format \
+ 'YYYYMMDDhhmmss'.  A value of '0' will cause the shutdown to be scheduled for \
+ immediate execution.  When this option is specified the operation will be \
+ scheduled to start at the specified time after which this utility will exit \
+ immediately
 INFO_STOPDS_DESCRIPTION_TRUST_ALL_385=Trust all server SSL certificates
 INFO_STOPDS_DESCRIPTION_KSFILE_386=Certificate key store path
 INFO_STOPDS_DESCRIPTION_KSPW_387=Certificate key store PIN
@@ -2136,7 +2140,7 @@
   cannot be canceled
 SEVERE_ERR_TASK_CLIENT_TASK_STATE_UNKNOWN_1455=State for task '%s' cannot be \
   determined
-INFO_DESCRIPTION_START_DATETIME_1456=Indicates the date/time at which the this \
+INFO_DESCRIPTION_START_DATETIME_1456=Indicates the date/time at which this \
   operation will start when scheduled as a server task expressed in format \
   'YYYYMMDDhhmmss'.  A value of '0' will cause the task to be scheduled for \
   immediate execution.  When this option is specified the operation will be \
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/StopDS.java b/opendj-sdk/opends/src/server/org/opends/server/tools/StopDS.java
index 7fe7489..02374c1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/StopDS.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/StopDS.java
@@ -54,6 +54,7 @@
 import org.opends.server.protocols.ldap.LDAPMessage;
 import org.opends.server.protocols.ldap.LDAPResultCode;
 import org.opends.server.tasks.ShutdownTask;
+import org.opends.server.tools.tasks.TaskTool;
 import org.opends.server.types.Control;
 import org.opends.server.types.LDAPException;
 import org.opends.server.types.NullOutputStream;
@@ -519,15 +520,18 @@
     if (stopTimeStr.isPresent())
     {
       String timeStr = stopTimeStr.getValue();
-      try
+      if (!TaskTool.NOW.equals(timeStr))
       {
-        stopTime = parseDateTimeString(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;
+        try
+        {
+          stopTime = parseDateTimeString(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;
+        }
       }
     }
 

--
Gitblit v1.10.0