[Fedora-directory-commits] directoryconsole/src/com/netscape/admin/dirserv/panel DSEntrySet.java, 1.2, 1.3

Richard Allen Megginson rmeggins at fedoraproject.org
Thu Dec 11 20:46:28 UTC 2008


Author: rmeggins

Update of /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv/panel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25004/directoryconsole/src/com/netscape/admin/dirserv/panel

Modified Files:
	DSEntrySet.java 
Log Message:
Resolves: bug 177334
Bug Description: LDBM Plug-in Settings console UI value checking issues
Reviewed by: nkinder (Thanks!)
Fix Description: The code was unconditionally resetting the field before checking the result of the modify operation.  The correct way to do it is to reset the field only after the modify operation succeeded.   I create a Vector of fields that are being modified, and only reset them if the modify succeeded.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no



Index: DSEntrySet.java
===================================================================
RCS file: /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv/panel/DSEntrySet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DSEntrySet.java	15 Feb 2006 23:00:55 -0000	1.2
+++ DSEntrySet.java	11 Dec 2008 20:46:26 -0000	1.3
@@ -320,6 +320,7 @@
         // loop through our list of unique DNs
         boolean retval = false;
 		boolean requiresRestart = false;
+		Vector needReset = new Vector();
 		for (Enumeration e = _dnToAttributeNameArrayMap.keys();
 			 e.hasMoreElements(); ) {
             String dn = (String)e.nextElement();
@@ -361,8 +362,8 @@
         					requiresRestart = DSUtil.requiresRestart( dn, attrName );
                         }
                         dirty = true; 
-                        // reset it now
-                        ((DSEntry)dse).reset();
+                        // possibly reset if save successful
+                        needReset.add(dse);
                     }
                     for (int kk = 0; sa != null && kk < sa.length; ++kk) {
                         values.addElement(sa[kk]);
@@ -408,6 +409,17 @@
 					} else {
 						ldc.modify(dn, ldapmodset);
 						ldapmodset = null;
+						// reset the fields that were dirty and were successfully
+						// stored to the server - this means that if ldc.modify
+						// threw an exception, we do not get to this code, and
+						// therefore all of the fields will be left marked as
+						// dirty and un-reset
+						Enumeration nmr = needReset.elements();
+						while (nmr.hasMoreElements()) {
+						    DSEntry dse = (DSEntry)nmr.nextElement();
+						    dse.reset(); // save was successful - reset
+						}
+						needReset = null;
 					}
                     done = true;
                     retval = true;




More information about the Fedora-directory-commits mailing list