From 4af6c0362e528ebab371325232a557a5338a31d8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 18 Sep 2014 11:32:20 +0000
Subject: [PATCH] OPENDJ-1548 (CR-4579) In changelog backend, persistent searches should perform the same validations as normal searches

---
 opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java |   47 +++++++++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java
index 8d57883..c6f79b7 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java
@@ -225,34 +225,33 @@
     // will be overwritten.
     setResultCode(ResultCode.SUCCESS);
 
-
-    // If there's a persistent search, then register it with the server.
-    boolean processSearchNow = true;
-    if (persistentSearch != null)
-    {
-      // If we're only interested in changes, then we do not actually want
-      // to process the search now.
-      processSearchNow = !persistentSearch.isChangesOnly();
-
-      // The Core server maintains the count of concurrent persistent searches
-      // so that all the backends (Remote and Local) are aware of it. Verify
-      // with the core if we have already reached the threshold.
-      if (!DirectoryServer.allowNewPersistentSearch())
-      {
-        setResultCode(ResultCode.ADMIN_LIMIT_EXCEEDED);
-        appendErrorMessage(ERR_MAX_PSEARCH_LIMIT_EXCEEDED.get());
-        return;
-      }
-      backend.registerPersistentSearch(persistentSearch);
-      persistentSearch.enable();
-    }
-
-
-    // Process the search in the backend and all its subordinates.
     try
     {
+      // If there's a persistent search, then register it with the server.
+      boolean processSearchNow = true;
+      if (persistentSearch != null)
+      {
+        // If we're only interested in changes, then we do not actually want
+        // to process the search now.
+        processSearchNow = !persistentSearch.isChangesOnly();
+
+        // The Core server maintains the count of concurrent persistent searches
+        // so that all the backends (Remote and Local) are aware of it. Verify
+        // with the core if we have already reached the threshold.
+        if (!DirectoryServer.allowNewPersistentSearch())
+        {
+          setResultCode(ResultCode.ADMIN_LIMIT_EXCEEDED);
+          appendErrorMessage(ERR_MAX_PSEARCH_LIMIT_EXCEEDED.get());
+          return;
+        }
+        backend.registerPersistentSearch(persistentSearch);
+        persistentSearch.enable();
+      }
+
+
       if (processSearchNow)
       {
+        // Process the search in the backend and all its subordinates.
         backend.search(this);
       }
     }

--
Gitblit v1.10.0