From f6f44d80e15b638b013a725396a8d7fe03031a1f Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 06 May 2008 22:12:59 +0000
Subject: [PATCH] Fixed an issue where a NPE could be thrown when the server processes a mod DN operation with a new superior entry thats in the subtree to be moved. An informative error message is added so the user can fix the mistake. 

---
 opends/src/server/org/opends/server/backends/jeb/EntryContainer.java |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
index c3faf07..903e8cd 100644
--- a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -194,7 +194,6 @@
   /**
    * Cached value from config so they don't have to be retrieved per operation.
    */
-  private int deadlockRetryLimit;
 
   private int subtreeDeleteSizeLimit;
 
@@ -501,7 +500,6 @@
     }
     this.databasePrefix = builder.toString();
 
-    this.deadlockRetryLimit = config.getDeadlockRetryLimit();
     this.subtreeDeleteSizeLimit = config.getSubtreeDeleteSizeLimit();
     this.subtreeDeleteBatchSize = config.getSubtreeDeleteBatchSize();
 
@@ -1781,7 +1779,6 @@
   {
     // Attempt the operation under a transaction until it fails or completes.
     boolean completed = false;
-    int retryRemaining = deadlockRetryLimit;
     while (!completed)
     {
       // Start a transaction.
@@ -1796,18 +1793,6 @@
         EntryContainer.transactionCommit(txn);
         completed = true;
       }
-      catch (DeadlockException deadlockException)
-      {
-        EntryContainer.transactionAbort(txn);
-        if (retryRemaining-- <= 0)
-        {
-          throw deadlockException;
-        }
-        if (debugEnabled())
-        {
-          TRACER.debugCaught(DebugLogLevel.ERROR, deadlockException);
-        }
-      }
       catch (DatabaseException databaseException)
       {
         EntryContainer.transactionAbort(txn);
@@ -1827,7 +1812,12 @@
       {
         EntryContainer.transactionAbort(txn);
 
-        Message message = ERR_JEB_UNCHECKED_EXCEPTION.get();
+        String msg = e.getMessage();
+        if (msg == null)
+        {
+          msg = stackTraceToSingleLineString(e);
+        }
+        Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(msg);
         throw new JebException(message, e);
       }
     }
@@ -4247,8 +4237,13 @@
         {
           transactionAbort(txn);
 
-          Message message = ERR_JEB_UNCHECKED_EXCEPTION.get();
-          throw new JebException(message, e);
+        String msg = e.getMessage();
+        if (msg == null)
+        {
+          msg = stackTraceToSingleLineString(e);
+        }
+        Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(msg);
+        throw new JebException(message, e);
         }
       }
       else
@@ -4349,7 +4344,6 @@
     id2entry.setDataConfig(entryDataConfig);
 
     this.config = cfg;
-    this.deadlockRetryLimit = config.getDeadlockRetryLimit();
     this.subtreeDeleteSizeLimit = config.getSubtreeDeleteSizeLimit();
     this.subtreeDeleteBatchSize = config.getSubtreeDeleteBatchSize();
     return new ConfigChangeResult(ResultCode.SUCCESS,

--
Gitblit v1.10.0