From 75591684d7efbc0aef005308f9539708ef3aca2a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 13 Dec 2011 00:18:29 +0000
Subject: [PATCH] Fix OPENDJ-385: Unable to perform object identifier equality matches using object classes which are not defined in the schema

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java               |   37 +------------------------------------
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java |    3 +--
 2 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
index 7f59333..c028032 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
@@ -45,40 +45,6 @@
 final class ObjectIdentifierEqualityMatchingRuleImpl extends
     AbstractMatchingRuleImpl
 {
-  static class OIDAssertion implements Assertion
-  {
-    private final String oid;
-
-
-
-    OIDAssertion(final String oid)
-    {
-      this.oid = oid;
-    }
-
-
-
-    public ConditionResult matches(final ByteSequence attributeValue)
-    {
-      final String attrStr = attributeValue.toString();
-
-      // We should have normalized all values to OIDs. If not, we know
-      // the descriptor form is not valid in the schema.
-      if (attrStr.length() == 0 || !StaticUtils.isDigit(attrStr.charAt(0)))
-      {
-        return ConditionResult.UNDEFINED;
-      }
-      if (oid.length() == 0 || !StaticUtils.isDigit(oid.charAt(0)))
-      {
-        return ConditionResult.UNDEFINED;
-      }
-
-      return attrStr.equals(oid) ? ConditionResult.TRUE : ConditionResult.FALSE;
-    }
-  }
-
-
-
   static String resolveNames(final Schema schema, final String oid)
   {
     if (!StaticUtils.isDigit(oid.charAt(0)))
@@ -164,8 +130,7 @@
     final SubstringReader reader = new SubstringReader(definition);
     final String normalized = resolveNames(schema, SchemaUtils.readOID(reader,
         schema.allowMalformedNamesAndOptions()));
-
-    return new OIDAssertion(normalized);
+    return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
   }
 
 
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
index c65b3ed..d8a4ac6 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
@@ -62,8 +62,7 @@
     final String normalized = ObjectIdentifierEqualityMatchingRuleImpl
         .resolveNames(schema, SchemaUtils.readOID(reader,
             schema.allowMalformedNamesAndOptions()));
-
-    return new ObjectIdentifierEqualityMatchingRuleImpl.OIDAssertion(normalized);
+    return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
   }
 
 

--
Gitblit v1.10.0