mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
02.28.2007 49587b4efe9d7669148b9c8978ac4ebfc2de92c5
Addresses issue 2370 in which the non-interactive option issued a success message to a request to cancel an uninterruptable task while executing.  This code also causes the command to return a non-zero error code if a non-interactive cancel or info operation is unsuccessful.
2 files modified
23 ■■■■ changed files
opends/src/messages/messages/tools.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ManageTasks.java 21 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/tools.properties
@@ -2181,4 +2181,6 @@
  invalid.  The value must be one of %s
SEVERE_ERR_TASKTOOL_FDA_WITH_NO_DEPENDENCY_1476=The failed dependency action \
  option is to be used in conjunction with one or more dependencies
SEVERE_ERR_TASKINFO_TASK_NOT_CANCELABLE_TASK_1477=Error:  task %s is not in a \
  cancelable state
opends/src/server/org/opends/server/tools/ManageTasks.java
@@ -252,12 +252,16 @@
        } else if (task.isPresent()) {
          println();
          new PrintTaskInfo(task.getValue()).invoke(this);
          MenuResult<TaskEntry> r =
                  new PrintTaskInfo(task.getValue()).invoke(this);
          if (r.isAgain()) return 1;
        } else if (summary.isPresent()) {
          println();
          printSummaryTable();
        } else if (cancel.isPresent()) {
          new CancelTask(cancel.getValue()).invoke(this);
          MenuResult<TaskEntry> r =
                  new CancelTask(cancel.getValue()).invoke(this);
          if (r.isAgain()) return 1;
        }
      } catch (LDAPConnectionException lce) {
@@ -713,6 +717,7 @@
      } catch (Exception e) {
        app.println(ERR_TASKINFO_RETRIEVING_TASK_ENTRY.get(
                    taskId, e.getMessage()));
        return MenuResult.again();
      }
      return MenuResult.success(taskEntry);
    }
@@ -911,9 +916,15 @@
            throws CLIException
    {
      try {
        TaskEntry entry = app.getTaskClient().cancelTask(taskId);
        app.println(INFO_TASKINFO_CMD_CANCEL_SUCCESS.get(taskId));
        return MenuResult.success(entry);
        TaskEntry entry = app.getTaskClient().getTaskEntry(taskId);
        if (entry.isCancelable()) {
          app.getTaskClient().cancelTask(taskId);
          app.println(INFO_TASKINFO_CMD_CANCEL_SUCCESS.get(taskId));
          return MenuResult.success(entry);
        } else {
          app.println(ERR_TASKINFO_TASK_NOT_CANCELABLE_TASK.get(taskId));
          return MenuResult.again();
        }
      } catch (Exception e) {
        app.println(ERR_TASKINFO_CANCELING_TASK.get(
                taskId, e.getMessage()));