From 347f1426c8ec959211c2c01110042198a2da93a4 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 23 Dec 2013 12:03:45 +0000
Subject: [PATCH] Simple fix for OPENDJ-1082: Order attributes according to search request attribute list order

---
 opends/src/server/org/opends/server/types/Entry.java |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/opends/src/server/org/opends/server/types/Entry.java b/opends/src/server/org/opends/server/types/Entry.java
index 851a60f..74f4a12 100644
--- a/opends/src/server/org/opends/server/types/Entry.java
+++ b/opends/src/server/org/opends/server/types/Entry.java
@@ -4857,24 +4857,26 @@
     if (attrNameList == null || attrNameList.isEmpty())
     {
       // Common case: return filtered user attributes.
-      userAttrsCopy =
-          new HashMap<AttributeType, List<Attribute>>(userAttributes.size());
-      operationalAttrsCopy = new HashMap<AttributeType, List<Attribute>>(0);
+      userAttrsCopy = new LinkedHashMap<AttributeType, List<Attribute>>(
+          userAttributes.size());
+      operationalAttrsCopy =
+          new LinkedHashMap<AttributeType, List<Attribute>>(0);
 
       if (omitReal)
       {
-        objectClassesCopy = new HashMap<ObjectClass, String>(0);
+        objectClassesCopy = new LinkedHashMap<ObjectClass, String>(0);
       }
       else if (omitValues)
       {
-        objectClassesCopy = new HashMap<ObjectClass, String>(0);
+        objectClassesCopy = new LinkedHashMap<ObjectClass, String>(0);
 
         // Add empty object class attribute.
         userAttrsCopy.put(ocType, newList(Attributes.empty(ocType)));
       }
       else
       {
-        objectClassesCopy = new HashMap<ObjectClass, String>(objectClasses);
+        objectClassesCopy =
+            new LinkedHashMap<ObjectClass, String>(objectClasses);
 
         // First, add the objectclass attribute.
         Attribute ocAttr = getObjectClassAttribute();
@@ -4893,18 +4895,18 @@
       // Incrementally build table of attributes.
       if (omitReal || omitValues)
       {
-        objectClassesCopy = new HashMap<ObjectClass, String>(0);
+        objectClassesCopy = new LinkedHashMap<ObjectClass, String>(0);
       }
       else
       {
         objectClassesCopy =
-            new HashMap<ObjectClass, String>(objectClasses.size());
+            new LinkedHashMap<ObjectClass, String>(objectClasses.size());
       }
 
-      userAttrsCopy =
-          new HashMap<AttributeType, List<Attribute>>(userAttributes.size());
+      userAttrsCopy = new LinkedHashMap<AttributeType, List<Attribute>>(
+          userAttributes.size());
       operationalAttrsCopy =
-          new HashMap<AttributeType, List<Attribute>>(
+          new LinkedHashMap<AttributeType, List<Attribute>>(
               operationalAttributes.size());
 
       for (String attrName : attrNameList)

--
Gitblit v1.10.0