From 1d131fed4f0bce4a2ce1acea9757a84925f1512a Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 17 Sep 2010 21:59:24 +0000
Subject: [PATCH] Resolve usability ambiguity with TaskTool : make TaskTool check that connection arguments are present before accepting task scheduling options

---
 opendj-sdk/opends/src/messages/messages/tools.properties                 |    5 ++++-
 opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskTool.java |   10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/tools.properties b/opendj-sdk/opends/src/messages/messages/tools.properties
index a3a567b..de2e120 100644
--- a/opendj-sdk/opends/src/messages/messages/tools.properties
+++ b/opendj-sdk/opends/src/messages/messages/tools.properties
@@ -2164,6 +2164,9 @@
 SEVERE_ERR_TASK_TOOL_START_TIME_NO_LDAP_1459=You have provided options for \
   scheduling this operation as a task but options provided for connecting to \
   the server's tasks backend resulted in the following error: '%s'
+SEVERE_ERR_TASK_TOOL_NO_VALID_LDAP_OPTIONS_1460=You have provided options for \
+  scheduling this operation as a task but options provided for connecting to \
+  the server's tasks backend are invalid or missing
 INFO_DESCRIPTION_PROP_FILE_PATH_1461=Path to the file containing default \
   property values used for command line arguments
 INFO_DESCRIPTION_NO_PROP_FILE_1462=No properties file will be \
@@ -2569,6 +2572,6 @@
 attempting to write entry to LDIF:  Could not calculate the DN for the \
 entry (no value found for the RDN attribute %s)
 SEVERE_ERR_CLIENT_SIDE_TIMEOUT_1714=A client side timeout occurred.\
- %nAdditional Information:  %s 
+ %nAdditional Information:  %s
 INFO_LABEL_DBTEST_INDEX_UNDEFINED_RECORD_COUNT_1715=Undefined
 
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskTool.java b/opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
index 59b5679..929dd84 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
@@ -236,7 +236,15 @@
    * @throws CLIException if there is a problem with one of the values provided
    * by the user.
    */
-  protected void validateTaskArgs() throws ArgumentException, CLIException {
+  protected void validateTaskArgs() throws ArgumentException, CLIException
+  {
+    if ((startArg.isPresent() || recurringArg.isPresent()) &&
+            !processAsTask())
+    {
+      throw new ArgumentException(
+              ERR_TASK_TOOL_NO_VALID_LDAP_OPTIONS.get());
+    }
+
     if (startArg.isPresent() && !NOW.equals(startArg.getValue())) {
       try {
         Date date = StaticUtils.parseDateTimeString(startArg.getValue());

--
Gitblit v1.10.0