Author: rmeggins
Update of /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9834
Modified Files:
DSContentPage.java
Log Message:
Bug(s) fixed: 167761
Bug Description: Directory Server issue with Admin Console
Reviewed by: Nathan (Thanks!)
Fix Description: DSContentPage.actionSearchUG clones an LDAPConnection
for use by the search and edit windows. After invoking the search
window, it closed the connection. While this works for the actionEdit
and actionAdvancedEdit callbacks, it doesn't work here because the
search results window is invoked in a separate thread, which means the
connection was being closed out from under the result list and edit
windows. The solution is to have the LDAPConnection be closed after the
edit list window dialog is finished. I also added some additional
debugging.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
Index: DSContentPage.java
===================================================================
RCS file: /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv/DSContentPage.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- DSContentPage.java 18 Jul 2005 00:55:38 -0000 1.1.1.1
+++ DSContentPage.java 9 Sep 2005 18:23:11 -0000 1.2
@@ -1310,15 +1310,22 @@
info.setUserHost(rpLdc.getHost());
info.setUserPort(rpLdc.getPort());
// user/group window search
+ Debug.println(9, "DSContentPage.actionSearchUG: cloned connection ["
+ + rpLdc + "] isConnected=" + rpLdc.isConnected()
+ + " isAuthenticated=" + rpLdc.isAuthenticated());
ResourcePickerDlg resourcePickerDlg =
new ResourcePickerDlg( info, new SearchUG(_framework, _iconPool, rpLdc, _entryEditor),
_framework );
resourcePickerDlg.appendSearchInterface( new DSSearchPanel() );
resourcePickerDlg.show();
+
+ /* richm 09/09/2005
+ although actionEdit and actionAdvancedEdit close the ldc cloned for editing
+ purposes, we cannot do that here, because SearchUG will eventually spawn
+ a separate thread on which the editing occurs - if we close it here, we
+ may close it out from underneath the editor
+ */
- try {
- rpLdc.disconnect(); // prepareReferralConnection clones connection
- } catch (Exception ignore) {}
_connectionPool.releaseConnection(ldc);
}
}
@@ -2742,7 +2749,10 @@
protected LDAPConnection getConnectionForNode(IBrowserNodeInfo node) throws LDAPException {
- LDAPConnection ldc = _connectionPool.getConnection(node.getURL());
+ LDAPConnection ldc = _connectionPool.getConnection(node.getURL());
+ Debug.println(9, "DSContentPage.getConnectionForNode: for node [" + node + "] getting "
+ + "connection [" + ldc + "] isConnected=" + ldc.isConnected()
+ + " isAuthenticated=" + ldc.isAuthenticated());
return ldc;
}
@@ -2751,14 +2761,23 @@
* the original one and should be closed after use
*/
protected LDAPConnection prepareReferralConnection(LDAPConnection ldc) {
+ Debug.println(9, "DSContentPage.prepareReferralConnection: original connection ["
+ + ldc + "] isConnected=" + ldc.isConnected()
+ + " isAuthenticated=" + ldc.isAuthenticated());
LDAPConnection result =(LDAPConnection)ldc.clone();
LDAPSearchConstraints lsc = (LDAPSearchConstraints)ldc.getSearchConstraints();
if (!getFollowReferrals()) {
// disable referrals
lsc.setServerControls(_manageDSAITControl);
+ Debug.println(9, "DSContentPage.prepareReferralConnection: no follow referrals connection ["
+ + result + "] isConnected=" + result.isConnected()
+ + " isAuthenticated=" + result.isAuthenticated());
}
else { // follow referrals using the current credentials
+ Debug.println(9, "DSContentPage.prepareReferralConnection: follow referrals connection ["
+ + result + "] isConnected=" + result.isConnected()
+ + " isAuthenticated=" + result.isAuthenticated());
final String dn = ldc.getAuthenticationDN();
final String pw = ldc.getAuthenticationPassword();
lsc.setRebindProc(new LDAPRebind() {
@@ -2934,6 +2953,8 @@
_iconPool = iconPool;
_ldc = ldc;
_entryEditor = entryEditor;
+ Debug.println(9, "DSContentPage.SearchUG: _ldc [" + _ldc + "] isConnected=" + ldc.isConnected() +
+ " isAuthenticated=" + ldc.isAuthenticated());
}
/**
@@ -2976,9 +2997,29 @@
if (dlg.getWidth() > _frame.getWidth()) {
dlg.setSize(_frame.getWidth(), dlg.getHeight());
}
+ Debug.println(9, "DSContentPage.SearchUG.getResults: _ldc [" + _ldc + "] isConnected=" + _ldc.isConnected() +
+ " isAuthenticated=" + _ldc.isAuthenticated());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
dlg.showModal();
+ /*
+ We need to close the connection that was opened in actionSearchUG and passed
+ to the constructor of SearchUG
+ */
+ try {
+ Debug.println(9, "DSContentPage.SearchUG.getResults: before disconnect connection ["
+ + _ldc + "] isConnected=" + _ldc.isConnected()
+ + " isAuthenticated=" + _ldc.isAuthenticated());
+ _ldc.disconnect(); // prepareReferralConnection clones connection
+ Debug.println(9, "DSContentPage.SearchUG.getResults: after disconnect connection ["
+ + _ldc + "] isConnected=" + _ldc.isConnected()
+ + " isAuthenticated=" + _ldc.isAuthenticated());
+ } catch (Exception ignore) {
+ Debug.println(9, "DSContentPage.SearchUG.getResults: caught exception ["
+ + ignore + "] disconnecting connection ["
+ + _ldc + "] isConnected=" + _ldc.isConnected()
+ + " isAuthenticated=" + _ldc.isAuthenticated());
+ }
}
});
}
@@ -4673,7 +4714,10 @@
* @param isAdvanced set this option to true in order to display ALWAYS the generic property editor.
*
* @return true if the entry was modified, false otherwise */
- public boolean editObject(String entryDn, LDAPConnection ldc, boolean isAdvanced) {
+ public boolean editObject(String entryDn, LDAPConnection ldc, boolean isAdvanced) {
+ Debug.println(9, "DSContentPage.editObject: begin entryDN [" + entryDn
+ + "] ldc [" + ldc + "] isConnected=" + ldc.isConnected() +
+ " isAuthenticated=" + ldc.isAuthenticated());
boolean objectModified = false;
_editedObjectDn = null;
_ldc = ldc;
@@ -4693,6 +4737,15 @@
}
_allAttrs = allAttributes;
}
+
+ if (_allAttrs == null) {
+ Debug.println(9, "DSContentPage.editObject: _allAttrs == null");
+ } else {
+ for (int ii = 0; ii < _allAttrs.length; ++ii) {
+ Debug.println(9, "DSContentPage.editObject: _allAttrs[" + ii + "]=["
+ + _allAttrs[ii] + "]");
+ }
+ }
LDAPSearchConstraints searchConstraints = (LDAPSearchConstraints)_ldc.getSearchConstraints().clone();
if (!entryDn.trim().equals("")) {
@@ -4703,6 +4756,7 @@
try {
entry = _ldc.read(entryDn, _allAttrs, searchConstraints);
} catch (LDAPException lde) {
+ Debug.println("DSContentPage.editObject: LDAPException [" + lde + "]");
/* The entry could not be read... */
String[] args = {
entryDn,