From d1e5fe55252799742c6dc12265130edce17ff4be Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 27 Sep 2006 20:28:10 +0000
Subject: [PATCH] Make a few general changes to operation processing:

---
 opends/src/server/org/opends/server/core/Operation.java |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/Operation.java b/opends/src/server/org/opends/server/core/Operation.java
index baf1b94..1f5c35d 100644
--- a/opends/src/server/org/opends/server/core/Operation.java
+++ b/opends/src/server/org/opends/server/core/Operation.java
@@ -152,7 +152,15 @@
     this.clientConnection = clientConnection;
     this.operationID      = operationID;
     this.messageID        = messageID;
-    this.requestControls  = requestControls;
+
+    if (requestControls == null)
+    {
+      this.requestControls = new ArrayList<Control>(0);
+    }
+    else
+    {
+      this.requestControls  = requestControls;
+    }
 
     resultCode                 = ResultCode.UNDEFINED;
     additionalLogMessage       = new StringBuilder();
@@ -831,6 +839,39 @@
 
 
   /**
+   * Indicates that this operation has been cancelled.  If appropriate, it will
+   * send a response to the client to indicate that.  This method must not be
+   * called by abandon, bind, or unbind operations under any circumstances, nor
+   * by extended operations if the request OID is that of the cancel or the
+   * StartTLS operation.
+   *
+   * @param  cancelRequest  The request to cancel this operation.
+   */
+  protected void indicateCancelled(CancelRequest cancelRequest)
+  {
+    assert debugEnter(CLASS_NAME, "indicateCancelled",
+                      String.valueOf(cancelRequest));
+
+    setCancelResult(CancelResult.CANCELED);
+
+    if (cancelRequest.notifyOriginalRequestor() ||
+        DirectoryServer.notifyAbandonedOperations())
+    {
+      setResultCode(ResultCode.CANCELED);
+
+      String cancelReason = cancelRequest.getCancelReason();
+      if (cancelReason != null)
+      {
+        appendErrorMessage(cancelReason);
+      }
+
+      clientConnection.sendResponse(this);
+    }
+  }
+
+
+
+  /**
    * Retrieves a string representation of this operation.
    *
    * @return  A string representation of this operation.

--
Gitblit v1.10.0