You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/11/22 01:08:47 UTC

svn commit: r597270 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java

Author: elecharny
Date: Wed Nov 21 16:08:46 2007
New Revision: 597270

URL: http://svn.apache.org/viewvc?rev=597270&view=rev
Log:
Fixed a bug in the applyModify() method : we were applying the modification a little bit too early

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=597270&r1=597269&r2=597270&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java Wed Nov 21 16:08:46 2007
@@ -586,8 +586,6 @@
         // the reversed modification
         for ( ModificationItem modification : forwardModifications )
         {
-            AttributeUtils.applyModification( clonedEntry, modification );
-
             switch ( modification.getModificationOp() )
             {
                 case DirContext.ADD_ATTRIBUTE :
@@ -609,6 +607,12 @@
                     
                     previous = modifiedEntry.get( mod.getID() );
                     
+                    if ( previous == null )
+                    {
+                        // Nothing to do if the previous attribute didn't exist
+                        continue;
+                    }
+                    
                     if ( mod.get() == null )
                     {
                         reverseModification = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, previous );
@@ -644,6 +648,9 @@
                     reverseModifications.add( 0, reverseModification );
                     break;
             }
+            
+            AttributeUtils.applyModification( clonedEntry, modification );
+            
         }
         
         // Special case if we don't have any reverse modifications