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/ManagedObjectPath.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/ManagedObjectPath.java b/opendj-sdk/opends/src/server/org/opends/server/admin/ManagedObjectPath.java
index ced9e0e8..eb164e1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/ManagedObjectPath.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/ManagedObjectPath.java
@@ -926,6 +926,39 @@
 
 
   /**
+   * Creates a new managed object path which has the same structure as
+   * this path except that the final path element is renamed. The
+   * final path element must comprise of an instantiable relation.
+   *
+   * @param newName
+   *          The new name of the final path element.
+   * @return Returns a new managed object path which has the same
+   *         structure as this path except that the final path element
+   *         is renamed.
+   * @throws IllegalStateException
+   *           If this managed object path is empty or if its final
+   *           path element does not comprise of an instantiable
+   *           relation.
+   */
+  @SuppressWarnings("unchecked")
+  public ManagedObjectPath<C, S> rename(String newName)
+      throws IllegalStateException {
+    if (elements.size() == 0) {
+      throw new IllegalStateException("Cannot rename an empty path");
+    }
+
+    if (r instanceof InstantiableRelationDefinition) {
+      InstantiableRelationDefinition<? super C, ? super S> ir =
+        (InstantiableRelationDefinition<? super C, ? super S>) r;
+      return parent().child(ir, d, newName);
+    } else {
+      throw new IllegalStateException("Not an instantiable relation");
+    }
+  }
+
+
+
+  /**
    * Serialize this managed object path using the provided
    * serialization strategy.
    * <p>

--
Gitblit v1.10.0