directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r612818 - /directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
Date Thu, 17 Jan 2008 13:57:10 GMT
Author: pamarcelot
Date: Thu Jan 17 05:56:25 2008
New Revision: 612818

URL: http://svn.apache.org/viewvc?rev=612818&view=rev
Log:
Fix for DIRSTUDIO-222 (Pb when creating an entry with an invalid atribute as a RDN).

Modified:
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java?rev=612818&r1=612817&r2=612818&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
Thu Jan 17 05:56:25 2008
@@ -155,10 +155,10 @@
             EventRegistry.suspendEventFireingInCurrentThread();
 
             // remove old RDN
-            if( newEntry.getRdn().size() > 0 )
+            if ( newEntry.getRdn().size() > 0 )
             {
                 Iterator<AttributeTypeAndValue> atavIterator = newEntry.getRdn().iterator();
-                while(atavIterator.hasNext())
+                while ( atavIterator.hasNext() )
                 {
                     AttributeTypeAndValue atav = atavIterator.next();
                     IAttribute attribute = newEntry.getAttribute( atav.getUpType() );
@@ -172,6 +172,15 @@
                                 attribute.deleteValue( values[v] );
                             }
                         }
+
+                        // If we have removed all the values of the attribute,
+                        // then we also need to remove this attribute from the
+                        // entry.
+                        // This test has been added to fix DIRSTUDIO-222
+                        if ( attribute.getValueSize() == 0 )
+                        {
+                            newEntry.deleteAttribute( attribute );
+                        }
                     }
                 }
             }
@@ -181,10 +190,10 @@
             newEntry.setDn( dn );
 
             // add new RDN
-            if( dn.getRdn().size() > 0 )
+            if ( dn.getRdn().size() > 0 )
             {
                 Iterator<AttributeTypeAndValue> atavIterator = dn.getRdn().iterator();
-                while(atavIterator.hasNext())
+                while ( atavIterator.hasNext() )
                 {
                     AttributeTypeAndValue atav = atavIterator.next();
                     IAttribute rdnAttribute = newEntry.getAttribute( atav.getUpType() );
@@ -250,7 +259,7 @@
     public IWizardPage getNextPage()
     {
         dnBuilderWidget.validate();
-        
+
         Rdn rdn = dnBuilderWidget.getRdn();
         LdapDN parentDn = dnBuilderWidget.getParentDn();
         final LdapDN dn = DnUtils.composeDn( rdn, parentDn );



Mime
View raw message