From efb0065f620775a1da3a65c17ffa4f3083fcab63 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sat, 07 Oct 2006 01:34:59 +0000
Subject: [PATCH] Update the modify operation so that it will reject any request that does not contain any modifications.

---
 opendj-sdk/opends/src/server/org/opends/server/messages/CoreMessages.java |   12 ++++++++++++
 opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java  |    8 ++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
index 5cb7369..40141c1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
@@ -807,6 +807,14 @@
         }
       }
 
+      if (modifications.isEmpty())
+      {
+        setResultCode(ResultCode.CONSTRAINT_VIOLATION);
+        appendErrorMessage(getMessage(MSGID_MODIFY_NO_MODIFICATIONS,
+                                      String.valueOf(entryDN)));
+        break modifyProcessing;
+      }
+
 
       // Check for and handle a request to cancel this operation.
       if (cancelRequest != null)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/messages/CoreMessages.java b/opendj-sdk/opends/src/server/org/opends/server/messages/CoreMessages.java
index 9b600f3..b6ad186 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/messages/CoreMessages.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/messages/CoreMessages.java
@@ -5927,6 +5927,15 @@
 
 
   /**
+   * The message ID for the message that will be used if a modify operation does
+   * not contain any modifications.  This does not take any arguments.
+   */
+  public static final int MSGID_MODIFY_NO_MODIFICATIONS =
+       CATEGORY_MASK_CORE | SEVERITY_MASK_SEVERE_ERROR | 566;
+
+
+
+  /**
    * Associates a set of generic messages with the message IDs defined
    * in this class.
    */
@@ -7008,6 +7017,9 @@
                     "persistent search has been terminated.");
 
 
+    registerMessage(MSGID_MODIFY_NO_MODIFICATIONS,
+                    "Entry %s cannot be updated because the request did not " +
+                    "contain any modifications.");
     registerMessage(MSGID_MODIFY_CANNOT_LOCK_ENTRY,
                     "Entry %s cannot be modified because the server failed " +
                     "to obtain a write lock for this entry after multiple " +

--
Gitblit v1.10.0