From ec6fcea7eb3b1013db8b26ff65327d3ab24077c9 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 09 Sep 2016 09:45:26 +0000
Subject: [PATCH] OPENDJ-3089 Several minor fixes from the PR

---
 opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
index f091e8f..c4c1a52 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
@@ -96,7 +96,6 @@
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.LDIFExportConfig;
 import org.opends.server.types.LDIFImportConfig;
-import org.opends.server.util.ActivateOnceSDKSchemaIsUsed;
 import org.opends.server.util.LDIFException;
 import org.opends.server.util.LDIFReader;
 import org.opends.server.util.LDIFWriter;
@@ -588,7 +587,6 @@
    * @throws DirectoryException
    *           If a problem occurs while trying to replace the entry.
    */
-  @ActivateOnceSDKSchemaIsUsed("uncomment code down below in this method")
   public void replaceEntry(final Entry oldEntry, final Entry newEntry) throws DirectoryException
   {
     final DN newEntryDN = newEntry.getName();
@@ -598,13 +596,12 @@
           ERR_CONFIG_FILE_MODIFY_NO_SUCH_ENTRY.get(oldEntry), getMatchedDN(newEntryDN), null);
     }
 
-    // TODO : add objectclass and attribute to the config schema in order to get this code run
-    // if (!Entries.getStructuralObjectClass(oldEntry, configEnabledSchema)
-    // .equals(Entries.getStructuralObjectClass(newEntry, configEnabledSchema)))
-    // {
-    // throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
-    // ERR_CONFIG_FILE_MODIFY_STRUCTURAL_CHANGE_NOT_ALLOWED.get(entryDN));
-    // }
+    if (!Entries.getStructuralObjectClass(oldEntry, serverContext.getSchema()).equals(
+        Entries.getStructuralObjectClass(newEntry, serverContext.getSchema())))
+    {
+      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
+          ERR_CONFIG_FILE_MODIFY_STRUCTURAL_CHANGE_NOT_ALLOWED.get(oldEntry.getName()));
+    }
 
     // Iterate through change listeners to make sure the change is acceptable.
     final List<ConfigChangeListener> changeListeners = getChangeListeners(newEntryDN);

--
Gitblit v1.10.0