From fff28547081591b9b506c43b2df646dea3a32405 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 15 Jul 2013 15:24:47 +0000
Subject: [PATCH] Extracted several time the method findAndSetMatchingDN(). We should look at moving this code to a single reusable place.

---
 opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java |   48 ++++++++++++++++++++++++++----------------------
 1 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
index f829e42..36f96fa 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -383,28 +383,7 @@
       if (getOriginalEntry() == null)
       {
         // See if one of the entry's ancestors exists.
-        parentDN = entryDN.getParentDNInSuffix();
-        while (parentDN != null)
-        {
-          try
-          {
-            if (DirectoryServer.entryExists(parentDN))
-            {
-              setMatchedDN(parentDN);
-              break;
-            }
-          }
-          catch (Exception e)
-          {
-            if (debugEnabled())
-            {
-              TRACER.debugCaught(DebugLogLevel.ERROR, e);
-            }
-            break;
-          }
-
-          parentDN = parentDN.getParentDNInSuffix();
-        }
+        findAndSetMatchingDN(entryDN);
 
         setResultCode(ResultCode.NO_SUCH_OBJECT);
         appendErrorMessage(ERR_MODDN_NO_CURRENT_ENTRY.get(String
@@ -594,6 +573,31 @@
     }
   }
 
+  private void findAndSetMatchingDN(DN entryDN)
+  {
+    try
+    {
+      DN matchedDN = entryDN.getParentDNInSuffix();
+      while (matchedDN != null)
+      {
+        if (DirectoryServer.entryExists(matchedDN))
+        {
+          setMatchedDN(matchedDN);
+          return;
+        }
+
+        matchedDN = matchedDN.getParentDNInSuffix();
+      }
+    }
+    catch (Exception e)
+    {
+      if (debugEnabled())
+      {
+        TRACER.debugCaught(DebugLogLevel.ERROR, e);
+      }
+    }
+  }
+
   /**
    * Processes the set of controls included in the request.
    *

--
Gitblit v1.10.0