From fe6545499558bb95484defd311ed83eced6aedf4 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 19 Jul 2007 14:54:30 +0000
Subject: [PATCH] Fix issues 1943 (unable to create je-index), 1996 (exception when creating components with empty names), and 1998 (exception when creating components with blank names).

---
 opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java b/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
index 46e222b..3e2505d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
@@ -83,7 +83,7 @@
      *         if the property definition is not handled by this LDAP
      *         profile wrapper.
      */
-    public String getAttributeName(ManagedObjectDefinition<?, ?> d,
+    public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d,
         PropertyDefinition<?> pd) {
       return null;
     }
@@ -192,7 +192,7 @@
    *           If the LDAP profile properties file associated with the
    *           provided managed object definition could not be loaded.
    */
-  public String getAttributeName(ManagedObjectDefinition<?, ?> d,
+  public String getAttributeName(AbstractManagedObjectDefinition<?, ?> d,
       PropertyDefinition<?> pd) throws MissingResourceException {
     for (Wrapper profile : profiles) {
       String attributeName = profile.getAttributeName(d, pd);
@@ -219,14 +219,20 @@
    */
   public String getInstantiableRelationChildRDNType(
       InstantiableRelationDefinition<?, ?> r) throws MissingResourceException {
-    for (Wrapper profile : profiles) {
-      String rdnType = profile.getInstantiableRelationChildRDNType(r);
-      if (rdnType != null) {
-        return rdnType;
+    if (r.getNamingPropertyDefinition() != null) {
+      // Use the attribute associated with the naming property.
+      return getAttributeName(r.getChildDefinition(), r
+          .getNamingPropertyDefinition());
+    } else {
+      for (Wrapper profile : profiles) {
+        String rdnType = profile.getInstantiableRelationChildRDNType(r);
+        if (rdnType != null) {
+          return rdnType;
+        }
       }
+      return resource.getString(r.getParentDefinition(), "naming-attribute."
+          + r.getName());
     }
-    return resource.getString(r.getParentDefinition(), "naming-attribute."
-        + r.getName());
   }
 
 

--
Gitblit v1.10.0