From 0cdc4f67dfc0e2fb8b83d5f0de8188ec3686d04c Mon Sep 17 00:00:00 2001
From: floblanc <floblanc@localhost>
Date: Tue, 10 Nov 2009 13:59:02 +0000
Subject: [PATCH] Fix Issue 4344 CompareOperation API does not support attribute options and Issue CompareOperationBasis does not properly handle get/setAttributeType.

---
 opends/src/server/org/opends/server/workflowelement/ndb/NDBCompareOperation.java |   32 ++++----------------------------
 1 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/opends/src/server/org/opends/server/workflowelement/ndb/NDBCompareOperation.java b/opends/src/server/org/opends/server/workflowelement/ndb/NDBCompareOperation.java
index ce1dc22..97bf4ae 100644
--- a/opends/src/server/org/opends/server/workflowelement/ndb/NDBCompareOperation.java
+++ b/opends/src/server/org/opends/server/workflowelement/ndb/NDBCompareOperation.java
@@ -28,8 +28,8 @@
 
 
 
-import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.opends.server.api.ClientConnection;
 import org.opends.server.api.plugin.PluginResult;
@@ -238,44 +238,20 @@
 
 
       // Get the base attribute type and set of options.
-      String baseName;
-      HashSet<String> options;
-      String rawAttributeType = getRawAttributeType();
-      int semicolonPos = rawAttributeType.indexOf(';');
-      if (semicolonPos > 0) {
-        baseName = toLowerCase(rawAttributeType.substring(0, semicolonPos));
-
-        options = new HashSet<String>();
-        int nextPos = rawAttributeType.indexOf(';', semicolonPos + 1);
-        while (nextPos > 0) {
-          options.add(rawAttributeType.substring(semicolonPos + 1, nextPos));
-          semicolonPos = nextPos;
-          nextPos = rawAttributeType.indexOf(';', semicolonPos + 1);
-        }
-
-        options.add(rawAttributeType.substring(semicolonPos + 1));
-      } else {
-        baseName = toLowerCase(rawAttributeType);
-        options = null;
-      }
-
+      Set<String> options = getAttributeOptions();
 
       // Actually perform the compare operation.
       AttributeType attrType = getAttributeType();
-      if (attrType == null) {
-        attrType = DirectoryServer.getAttributeType(baseName, true);
-        setAttributeType(attrType);
-      }
 
       List<Attribute> attrList = entry.getAttribute(attrType, options);
       if ((attrList == null) || attrList.isEmpty()) {
         setResultCode(ResultCode.NO_SUCH_ATTRIBUTE);
         if (options == null) {
           appendErrorMessage(WARN_COMPARE_OP_NO_SUCH_ATTR.get(
-            String.valueOf(entryDN), baseName));
+            String.valueOf(entryDN), getRawAttributeType()));
         } else {
           appendErrorMessage(WARN_COMPARE_OP_NO_SUCH_ATTR_WITH_OPTIONS.get(
-            String.valueOf(entryDN), baseName));
+            String.valueOf(entryDN), getRawAttributeType()));
         }
       } else {
         AttributeValue value = AttributeValues.create(attrType,

--
Gitblit v1.10.0