From 0ae0ba233fdf098993f9fc2361328ed4e3983636 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 03 Jun 2016 06:45:17 +0000
Subject: [PATCH] OPENDJ-3037 Inlined DirectoryServer.getMatchingRule()
---
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java b/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
index 371464d..4b80d77 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
@@ -35,6 +35,7 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
import org.opends.server.backends.RebuildConfig;
import org.opends.server.backends.VerifyConfig;
import org.opends.server.core.AddOperation;
@@ -322,9 +323,7 @@
}
String matchingRuleID = filter.getMatchingRuleID();
- MatchingRule matchingRule = matchingRuleID != null
- ? DirectoryServer.getMatchingRule(matchingRuleID)
- : attrType.getEqualityMatchingRule();
+ MatchingRule matchingRule = getMatchingRule(attrType, matchingRuleID);
// FIXME isIndexed() always return false down below
return matchingRule != null && isIndexed(attrType, matchingRule);
@@ -334,6 +333,23 @@
}
}
+ private MatchingRule getMatchingRule(AttributeType attrType, String matchingRuleID)
+ {
+ if (matchingRuleID == null)
+ {
+ return attrType.getEqualityMatchingRule();
+ }
+
+ try
+ {
+ return DirectoryServer.getSchema().getMatchingRule(matchingRuleID);
+ }
+ catch (UnknownSchemaElementException e)
+ {
+ return null;
+ }
+ }
+
/**
* Retrieves the requested entry from this backend. The caller is not required to hold any locks
* on the specified DN.
--
Gitblit v1.10.0