From d83376cc59bddb6fa9469d0c71943638422aa0c3 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 21 May 2012 14:25:28 +0000
Subject: [PATCH] Relax attribute description constraint for renameAttribute().
---
opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java b/opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
index 75e044f..ff43d3d 100644
--- a/opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
+++ b/opendj-sdk/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
@@ -30,8 +30,6 @@
import java.util.Collection;
import java.util.Iterator;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-
import com.forgerock.opendj.util.Iterators;
import com.forgerock.opendj.util.Validator;
@@ -357,28 +355,15 @@
* @param attribute
* The attribute to be renamed.
* @param attributeDescription
- * The new attribute description for {@code attribute}, which
- * must be compatible with {@code attribute}'s attribute
- * description.
+ * The new attribute description for {@code attribute}.
* @return A renamed view of {@code attribute}.
- * @throws IllegalArgumentException
- * If {@code attributeDescription} does not have the same
- * attribute type as {@code attribute}'s attribute description.
* @throws NullPointerException
* If {@code attribute} or {@code attributeDescription} was
* {@code null}.
*/
public static final Attribute renameAttribute(final Attribute attribute,
final AttributeDescription attributeDescription) {
- final AttributeType oldType = attribute.getAttributeDescription().getAttributeType();
- final AttributeType newType = attributeDescription.getAttributeType();
-
- // We could relax a bit by ensuring that they are both compatible
- // (e.g. one sub-type of another, or same equality matching rule,
- // etc).
- Validator
- .ensureTrue(oldType.equals(newType), "Old and new attribute type are not the same");
-
+ Validator.ensureNotNull(attribute, attributeDescription);
return new RenamedAttribute(attribute, attributeDescription);
}
--
Gitblit v1.10.0