Author: seelmann Date: Mon Jan 4 17:21:58 2010 New Revision: 895712 URL: http://svn.apache.org/viewvc?rev=895712&view=rev Log: Fixed the rename operation, values in RDN are already unescaped Modified: directory/apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java directory/apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java Modified: directory/apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java?rev=895712&r1=895711&r2=895712&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java (original) +++ directory/apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java Mon Jan 4 17:21:58 2010 @@ -35,7 +35,6 @@ import org.apache.directory.server.constants.ApacheSchemaConstants; import org.apache.directory.server.core.entry.ClonedServerEntry; import org.apache.directory.server.core.entry.ServerAttribute; -import org.apache.directory.server.core.entry.ServerBinaryValue; import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.entry.ServerStringValue; import org.apache.directory.server.core.partition.impl.btree.LongComparator; @@ -1378,25 +1377,10 @@ for ( AVA newAtav : newRdn ) { String newNormType = newAtav.getNormType(); - String newNormValue = newAtav.getNormValue().getString(); + Object newNormValue = newAtav.getNormValue().get(); AttributeType newRdnAttrType = schemaManager.lookupAttributeTypeRegistry( newNormType ); - Object unEscapedRdn = Rdn.unescapeValue( newAtav.getUpValue().getString() ); - - Value value = null; - - if ( unEscapedRdn instanceof String ) - { - value = new ServerStringValue( newRdnAttrType, ( String ) unEscapedRdn ); - } - else - { - value = new ServerBinaryValue( newRdnAttrType, ( byte[] ) unEscapedRdn ); - } - - value.normalize(); - - entry.add( newRdnAttrType, value ); + entry.add( newRdnAttrType, newAtav.getUpValue() ); if ( hasUserIndexOn( newNormType ) ) { Modified: directory/apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java?rev=895712&r1=895711&r2=895712&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java (original) +++ directory/apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java Mon Jan 4 17:21:58 2010 @@ -737,6 +737,33 @@ @Test + public void testRenameEscaped() throws Exception + { + LdapDN dn = new LdapDN( "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." ); + dn.normalize( schemaManager.getNormalizerMapping() ); + DefaultServerEntry entry = new DefaultServerEntry( schemaManager, dn ); + entry.add( "objectClass", "top", "person", "organizationalPerson" ); + entry.add( "ou", "Engineering" ); + entry.add( "cn", "Private Ryan"); + entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() ); + entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) ); + + store.add( entry ); + + Rdn rdn = new Rdn("sn=Ja\\+es"); + + store.rename( dn, rdn, true ); + + LdapDN dn2 = new LdapDN( "sn=Ja\\+es,ou=Engineering,o=Good Times Co." ); + dn2.normalize( schemaManager.getNormalizerMapping() ); + Long id = store.getEntryId( dn2.getNormName() ); + assertNotNull( id ); + ServerEntry entry2 = store.lookup( id ); + assertEquals("Ja+es", entry2.get( "sn" ).getString()); + } + + + @Test public void testMove() throws Exception { LdapDN childDn = new LdapDN( "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );