From 66c1a80d263b71195a525d1c1fdd59e464a606ae Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 20 Aug 2010 13:39:26 +0000
Subject: [PATCH] Fix all command lines that are doing Searches with JNDI, to avoid them sending systematic Abandon requests.

---
 opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
index 96fd760..d33ac2e 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -55,8 +55,10 @@
 import javax.naming.CompositeName;
 import javax.naming.InvalidNameException;
 import javax.naming.Name;
+import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapName;
 import javax.swing.BorderFactory;
@@ -628,6 +630,7 @@
       col.setCellRenderer(renderer);
     }
     MouseAdapter listMouseListener = new MouseAdapter() {
+      @Override
       public void mouseClicked(MouseEvent e) {
         TableColumnModel columnModel = table.getColumnModel();
         int viewColumn = columnModel.getColumnIndexAtX(e.getX());
@@ -2448,12 +2451,23 @@
      * Search for the config to check that it is the directory manager.
      */
     SearchControls searchControls = new SearchControls();
-    searchControls.setCountLimit(1);
     searchControls.setSearchScope(
     SearchControls. OBJECT_SCOPE);
     searchControls.setReturningAttributes(
     new String[] {"1.1"});
-    ctx.search("cn=config", "objectclass=*", searchControls);
+    NamingEnumeration<SearchResult> sr =
+      ctx.search("cn=config", "objectclass=*", searchControls);
+    try
+    {
+      while (sr.hasMore())
+      {
+        sr.next();
+      }
+    }
+    finally
+    {
+      sr.close();
+    }
   }
 
   /**

--
Gitblit v1.10.0