From 3749749fcfc4a3f9821fa8df2c0b93688971628e Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 12:48:19 +0000
Subject: [PATCH] Fix for issue #4536. Close JNDI enumerations to avoid unbinding and closing underlying LDAP connection. Fixes in all CLI and control panel.

---
 opends/src/ads/org/opends/admin/ads/TopologyCache.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/opends/src/ads/org/opends/admin/ads/TopologyCache.java b/opends/src/ads/org/opends/admin/ads/TopologyCache.java
index 8d36d01..bbc5685 100644
--- a/opends/src/ads/org/opends/admin/ads/TopologyCache.java
+++ b/opends/src/ads/org/opends/admin/ads/TopologyCache.java
@@ -475,13 +475,13 @@
     LdapName jndiName = new LdapName("cn=monitor");
 
     InitialLdapContext ctx = null;
+    NamingEnumeration<SearchResult> monitorEntries = null;
     try
     {
       ServerLoader loader =
         getServerLoader(replicationServer.getAdsProperties());
       ctx = loader.createContext();
-      NamingEnumeration<SearchResult> monitorEntries =
-        ctx.search(jndiName, filter, ctls);
+      monitorEntries = ctx.search(jndiName, filter, ctls);
 
       while(monitorEntries.hasMore())
       {
@@ -537,6 +537,10 @@
     }
     finally
     {
+      if (monitorEntries != null)
+      {
+        monitorEntries.close();
+      }
       if (ctx != null)
       {
         ctx.close();

--
Gitblit v1.10.0