From f2a4e4939b6067490f559de477d494ac61b4569d Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 06 Jun 2016 18:40:37 +0000
Subject: [PATCH] OPENDJ-3037 Remove duplicate check on ambiguous matching rule names

---
 opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java |   38 --------------------------------------
 1 files changed, 0 insertions(+), 38 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
index d02a95a..e324009 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -16,11 +16,9 @@
  */
 package org.opends.server.types;
 
-import static org.forgerock.opendj.ldap.ResultCode.*;
 import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
 import static org.forgerock.opendj.ldap.schema.SchemaOptions.*;
 import static org.opends.messages.BackendMessages.*;
-import static org.opends.messages.CoreMessages.*;
 import static org.opends.messages.SchemaMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -976,12 +974,6 @@
     exclusiveLock.lock();
     try
     {
-      if (!overwriteExisting)
-      {
-        // Not checked by SDK schema
-        checkNoConflictingMatchingRuleNames(matchingRules);
-      }
-
       SchemaBuilder builder = new SchemaBuilder(schemaNG);
       for (MatchingRule matchingRule : matchingRules)
       {
@@ -1007,36 +999,6 @@
     }
   }
 
-  private void checkNoConflictingMatchingRuleNames(Collection<MatchingRule> matchingRules) throws DirectoryException
-  {
-    final Map<String, MatchingRule> rules = new HashMap<>();
-    for (MatchingRule matchingRule : matchingRules)
-    {
-      for (String name : matchingRule.getNames())
-      {
-        if (schemaNG.hasMatchingRule(name))
-        {
-          // there should be only one
-          MatchingRule conflictingRule = schemaNG.getMatchingRulesWithName(name).iterator().next();
-          throw conflictingMatchingRuleName(name, matchingRule, conflictingRule);
-        }
-        MatchingRule conflictingRule = rules.get(name);
-        if (conflictingRule != null)
-        {
-          throw conflictingMatchingRuleName(name, matchingRule, conflictingRule);
-        }
-        rules.put(name, matchingRule);
-      }
-    }
-  }
-
-  private DirectoryException conflictingMatchingRuleName(
-      String name, MatchingRule matchingRule, MatchingRule conflictingRule)
-  {
-    return new DirectoryException(CONSTRAINT_VIOLATION,
-        ERR_SCHEMA_CONFLICTING_MR_NAME.get(matchingRule.getOID(), name, conflictingRule.getOID()));
-  }
-
   /**
    * Deregisters the provided matching rule definition with this schema.
    *

--
Gitblit v1.10.0