directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r802883 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java test/java/org/apache/directory/shared/ldap/ldif/LdifRevertorTest.java
Date Mon, 10 Aug 2009 18:24:36 GMT
Author: elecharny
Date: Mon Aug 10 18:24:36 2009
New Revision: 802883

URL: http://svn.apache.org/viewvc?rev=802883&view=rev
Log:
Fixed two bugs in the reverter : when modifying some entry, the generated entry was not correct

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifRevertorTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java?rev=802883&r1=802882&r2=802883&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
Mon Aug 10 18:24:36 2009
@@ -135,7 +135,7 @@
                 case ADD_ATTRIBUTE:
                     EntryAttribute mod = modification.getAttribute();
 
-                    EntryAttribute previous = modifiedEntry.get( mod.getId() );
+                    EntryAttribute previous = clonedEntry.get( mod.getId() );
 
                     if ( mod.equals( previous ) )
                     {
@@ -150,7 +150,7 @@
                 case REMOVE_ATTRIBUTE:
                     mod = modification.getAttribute();
 
-                    previous = modifiedEntry.get( mod.getId() );
+                    previous = clonedEntry.get( mod.getId() );
 
                     if ( previous == null )
                     {
@@ -162,7 +162,7 @@
                     {
                         reverseModification = new ClientModification( ModificationOperation.ADD_ATTRIBUTE,
previous );
                         reverseModifications.add( 0, reverseModification );
-                        continue;
+                        break;
                     }
 
                     reverseModification = new ClientModification( ModificationOperation.ADD_ATTRIBUTE,
mod );
@@ -172,7 +172,7 @@
                 case REPLACE_ATTRIBUTE:
                     mod = modification.getAttribute();
 
-                    previous = modifiedEntry.get( mod.getId() );
+                    previous = clonedEntry.get( mod.getId() );
 
                     /*
                      * The server accepts without complaint replace 
@@ -183,7 +183,7 @@
                      * modification for the reverse direction which should
                      * do nothing as well.  
                      */
-                    if ( mod.get() == null && previous == null )
+                    if ( ( mod.get() == null ) && ( previous == null ) )
                     {
                         reverseModification = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE,
                             new DefaultClientAttribute( mod.getId() ) );
@@ -349,10 +349,10 @@
                  !(ava.getNormType().equals( oldRdn.getNormType() ) &&
                    ava.getNormValue().equals( oldRdn.getNormValue() ) ) )
             {
-                // Create the modification, which is an Add
+                // Create the modification, which is an Remove
                 Modification modification = new ClientModification( 
                     ModificationOperation.REMOVE_ATTRIBUTE, 
-                    new DefaultClientAttribute( oldRdn.getUpType(), ava.getUpValue().getString()
) );
+                    new DefaultClientAttribute( ava.getUpType(), ava.getUpValue().getString()
) );
                 
                 restored.addModificationItem( modification );
             }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifRevertorTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifRevertorTest.java?rev=802883&r1=802882&r2=802883&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifRevertorTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifRevertorTest.java
Mon Aug 10 18:24:36 2009
@@ -515,9 +515,10 @@
             "replace: ou\n" +
             "ou: apache\n" +
             "ou: acme corp\n" +
+            "ou: BigCompany inc.\n" +
             "-\n" +
             "replace: l\n" +
-            "l: USA\n" +
+            "l: FR\n" +
             "-\n" +
             "delete: l\n" +
             "l: FR\n" +



Mime
View raw message