You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/01/17 14:57:10 UTC
svn commit: r612818 -
/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
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 );