From fb3a5a7ff610bb4aa6649bb4531d99405bf0ebcf Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Tue, 27 Apr 2010 20:56:50 +0000
Subject: [PATCH] Fixing several issues with the Control Panel, the QuickSetup, Core server and Replication. Also improves unit, functional tests. More specifically this commit resolves the following open issues: 4385 - NPE when using ExtensibleMatch filter without a matching rule 4521 - dynamic lookup in attribut selection when selecting the sort order attribut while defining VLV index 4531 - Control Panel creates virtual static groups using groupOfURLs as objectclass 4533 - NullPointerException when configuring replication between 2 OpenDS 4539 - DSML Gateway - jaxb.properties Exception
---
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
index dfcfa8e..764f16b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.backends.jeb;
import org.opends.messages.Message;
@@ -41,6 +41,7 @@
import org.opends.server.admin.std.server.LocalDBIndexCfg;
import org.opends.server.admin.std.meta.LocalDBIndexCfgDefn;
import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.api.EqualityMatchingRule;
import org.opends.server.api.ExtensibleIndexer;
import org.opends.server.api.ExtensibleMatchingRule;
import org.opends.server.api.IndexQueryFactory;
@@ -2373,6 +2374,50 @@
{
//Get the Matching Rule OID of the filter.
String nOID = extensibleFilter.getMatchingRuleID();
+ /**
+ * Use the default equality index in two conditions:
+ * 1. There is no matching rule provided
+ * 2. The matching rule specified is actually the default equality.
+ */
+ EqualityMatchingRule eqRule =
+ indexConfig.getAttribute().getEqualityMatchingRule();
+ if(nOID ==null || nOID.equals(eqRule.getOID()) ||
+ nOID.equalsIgnoreCase(eqRule.getName()))
+ {
+ //No matching rule is defined; use the default equality matching rule.
+ if(equalityIndex == null)
+ {
+ // There is no index on this matching rule.
+ return IndexQuery.createNullIndexQuery().evaluate();
+ }
+ try
+ {
+ // Make a key from the normalized assertion value.
+ byte[] keyBytes =
+ extensibleFilter.getAssertionValue().getNormalizedValue().
+ toByteArray();
+ DatabaseEntry key = new DatabaseEntry(keyBytes);
+
+ if(debugBuffer != null)
+ {
+ debugBuffer.append("[INDEX:");
+ debugBuffer.append(indexConfig.getAttribute().getNameOrOID());
+ debugBuffer.append(".");
+ debugBuffer.append("equality]");
+ }
+
+ // Read the key.
+ return equalityIndex.readKey(key, null, LockMode.DEFAULT);
+ }
+ catch (DirectoryException e)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ return IndexQuery.createNullIndexQuery().evaluate();
+ }
+ }
ExtensibleMatchingRule rule =
DirectoryServer.getExtensibleMatchingRule(nOID);
IndexQueryFactory<IndexQuery> factory = null;
@@ -2675,4 +2720,4 @@
return substringLength;
}
}
-}
\ No newline at end of file
+}
--
Gitblit v1.10.0