From f2711b53bdd5f48eaf312981541b61c6e89bdfa1 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 29 Mar 2013 18:06:19 +0000
Subject: [PATCH] Additional change for OPENDJ-354: Implement a RequestHandler which provides an in-memory backend

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
index 9d3d416..4514340 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
@@ -496,7 +496,13 @@
     public static final Attribute renameAttribute(final Attribute attribute,
             final AttributeDescription attributeDescription) {
         Validator.ensureNotNull(attribute, attributeDescription);
-        return new RenamedAttribute(attribute, attributeDescription);
+
+        // Optimize for the case where no renaming is required.
+        if (attribute.getAttributeDescription() == attributeDescription) {
+            return attribute;
+        } else {
+            return new RenamedAttribute(attribute, attributeDescription);
+        }
     }
 
     /**

--
Gitblit v1.10.0