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/ads/org/opends/admin/ads/ADSContext.java | 41 ++++++++++++++++++++++++++++++++++-------
1 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/opends/src/ads/org/opends/admin/ads/ADSContext.java b/opends/src/ads/org/opends/admin/ads/ADSContext.java
index a8b0fba..1f3634f 100644
--- a/opends/src/ads/org/opends/admin/ads/ADSContext.java
+++ b/opends/src/ads/org/opends/admin/ads/ADSContext.java
@@ -784,7 +784,7 @@
ne = attrs.getAll();
while (ne.hasMore())
{
- Attribute attr = (Attribute)ne.next();
+ Attribute attr = ne.next();
String attrID = attr.getID();
if (!attrID.toLowerCase().equals(
@@ -870,14 +870,16 @@
ne2 = dirContext.search(getInstanceKeysContainerDN(),
"(ds-cfg-key-id="+keyId+")", sc);
- if (ne2.hasMore())
+ boolean found = false;
+ while (ne2.hasMore())
{
SearchResult certEntry = ne2.next();
Attribute certAttr = certEntry.getAttributes().get(attrIDs[0]);
properties.put(ServerProperty.INSTANCE_PUBLIC_KEY_CERTIFICATE,
certAttr.get());
+ found = true;
}
- else
+ if (!found)
{
LOG.log(Level.WARNING, "Could not find public key for "+
properties);
@@ -1412,10 +1414,20 @@
sc.setReturningAttributes(attList);
NamingEnumeration<SearchResult> ne = dirContext.search(
dnCentralAdmin, "(objectclass=*)", sc);
- SearchResult sr = ne.next();
+ try
+ {
+ while (ne.hasMore())
+ {
+ SearchResult sr = ne.next();
- currentPrivileges = sr.getAttributes().get("ds-privilege-name")
- .getAll();
+ currentPrivileges = sr.getAttributes().get("ds-privilege-name")
+ .getAll();
+ }
+ }
+ finally
+ {
+ handleCloseNamingEnumeration(ne);
+ }
}
@@ -2237,7 +2249,22 @@
SearchControls sc = new SearchControls();
sc.setSearchScope(SearchControls.OBJECT_SCOPE);
- result = getDirContext().search(dn, "(objectclass=*)", sc).hasMore();
+ sc.setReturningAttributes(new String[] {"1.1"});
+ NamingEnumeration<SearchResult> sr =
+ getDirContext().search(dn, "(objectclass=*)", sc);
+ result = false;
+ try
+ {
+ while (sr.hasMore())
+ {
+ sr.next();
+ result = true;
+ }
+ }
+ finally
+ {
+ sr.close();
+ }
}
catch (NameNotFoundException x)
{
--
Gitblit v1.10.0