Index: shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java =================================================================== --- shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java (revision 179838) +++ shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java (working copy) @@ -349,7 +349,7 @@ public Name getSuffix( int a_posn ) { ArrayList list = new ArrayList(); - list.addAll( m_list.subList( a_posn, m_list.size() ) ); + list.addAll( m_list.subList( 0, size() - a_posn ) ); return new LdapName( list ) ; } Index: shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java =================================================================== --- shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java (revision 179838) +++ shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java (working copy) @@ -385,7 +385,7 @@ { if ( a_name1.size() == a_name2.size() ) { - return a_name2.startsWith( a_name1.getSuffix( 1 ) ) ; + return a_name2.startsWith( a_name1.getPrefix( a_name1.size() - 1 ) ) ; } return false ; Index: shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java =================================================================== --- shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java (revision 179838) +++ shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java (working copy) @@ -563,11 +563,11 @@ m_parser.parse( "cn=HomeDir,cn=John,ou=Marketing,ou=East" ) ; assertEquals( "cn=HomeDir,cn=John,ou=Marketing,ou=East", l_name.getSuffix( 0 ).toString() ) ; - assertEquals( "cn=John,ou=Marketing,ou=East", + assertEquals( "cn=HomeDir,cn=John,ou=Marketing", l_name.getSuffix( 1 ).toString() ) ; - assertEquals( "ou=Marketing,ou=East", + assertEquals( "cn=HomeDir,cn=John", l_name.getSuffix( 2 ).toString() ) ; - assertEquals( "ou=East", + assertEquals( "cn=HomeDir", l_name.getSuffix( 3 ).toString() ) ; assertEquals( "", l_name.getSuffix( 4 ).toString() ) ; Property changes on: apacheds/trunk/core ___________________________________________________________________ Name: svn:ignore - target *.dump *.ser *.dat *.log *.iml *.iws *.ipr .clover .project .generated.ajsym .classpath .generated.* eve + target *.dump *.ser *.dat *.log *.iml *.iws *.ipr .clover .project .generated.ajsym .classpath .generated.* eve build.xml .externalToolBuilders .settings patches Index: apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java =================================================================== --- apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java (revision 168355) +++ apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java (working copy) @@ -442,9 +442,9 @@ throw new LdapNoPermissionException( "can't rename the rootDSE" ); } - Name oldBase = oldName.getSuffix( 1 ); + Name oldBase = oldName.getPrefix( 1 ); - Name newBase = newName.getSuffix( 1 ); + Name newBase = newName.getPrefix( 1 ); String newRdn = newName.get( newName.size() - 1 ); @@ -481,7 +481,7 @@ } else { - Name parent = newDn.getSuffix( 1 ); + Name parent = newDn.getPrefix( 1 ); if ( newRdn.equalsIgnoreCase( oldRdn ) ) { Index: apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java =================================================================== --- apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java (revision 168355) +++ apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java (working copy) @@ -489,7 +489,7 @@ String targetDn = ( String ) aliasIdx.reverseLookup( aliasId ); BigInteger targetId = getEntryId( targetDn ); String aliasDn = getEntryDn( aliasId ); - Name ancestorDn = new LdapName( aliasDn ).getSuffix( 1 ); + Name ancestorDn = new LdapName( aliasDn ).getPrefix( 1 ); BigInteger ancestorId = getEntryId( ancestorDn.toString() ); /* @@ -508,7 +508,7 @@ while ( ! ancestorDn.equals( upSuffix ) ) { - ancestorDn = ancestorDn.getSuffix( 1 ); + ancestorDn = ancestorDn.getPrefix( 1 ); ancestorId = getEntryId( ancestorDn.toString() ); subAliasIdx.drop( ancestorId, targetId ); @@ -629,7 +629,7 @@ * index. If the target is not a sibling of the alias then we add the * index entry maping the parent's id to the aliased target id. */ - ancestorDn = aliasDn.getSuffix( 1 ); + ancestorDn = aliasDn.getPrefix( 1 ); ancestorId = getEntryId( ancestorDn.toString() ); if ( ! NamespaceTools.isSibling( targetDn, aliasDn ) ) @@ -654,7 +654,7 @@ subAliasIdx.add( ancestorId, targetId ); } - ancestorDn = ancestorDn.getSuffix( 1 ); + ancestorDn = ancestorDn.getPrefix( 1 ); ancestorId = getEntryId( ancestorDn.toString() ); } } @@ -682,13 +682,13 @@ } else { - parentId = getEntryId( dn.getSuffix( 1 ).toString() ); + parentId = getEntryId( dn.getPrefix( 1 ).toString() ); } // don't keep going if we cannot find the parent Id if ( parentId == null ) { - throw new LdapNameNotFoundException( "Id for parent '" + dn.getSuffix( 1 ).toString() + "' not found!" ); + throw new LdapNameNotFoundException( "Id for parent '" + dn.getPrefix( 1 ).toString() + "' not found!" ); } Attribute objectClass = entry.get( "objectClass" ); @@ -1632,7 +1632,7 @@ * Start droping index tuples with the first ancestor right above the * moved base. This is the first ancestor effected by the move. */ - Name ancestorDn = movedBase.getSuffix( 1 ); + Name ancestorDn = movedBase.getPrefix( 1 ); BigInteger ancestorId = getEntryId( ancestorDn.toString() ); /* @@ -1656,7 +1656,7 @@ while ( ! ancestorDn.equals( upSuffix ) ) { - ancestorDn = ancestorDn.getSuffix( 1 ); + ancestorDn = ancestorDn.getPrefix( 1 ); ancestorId = getEntryId( ancestorDn.toString() ); subAliasIdx.drop( ancestorId, targetId ); Index: apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java =================================================================== --- apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java (revision 168355) +++ apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java (working copy) @@ -165,7 +165,7 @@ return dn; } - dn = dn.getSuffix( 1 ); + dn = dn.getPrefix( 1 ); } return dn; Index: apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java =================================================================== --- apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java (revision 168355) +++ apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java (working copy) @@ -90,13 +90,13 @@ } Name parentDn = new LdapName( upName ); - parentDn = parentDn.getSuffix( 1 ); + parentDn = parentDn.getPrefix( 1 ); // check if we don't have the parent to add to assertHasEntry( "Attempt to add under non-existant parent: ", parentDn ); // check if we're trying to add to a parent that is an alias - Attributes attrs = nexus.lookup( normName.getSuffix( 1 ) ); + Attributes attrs = nexus.lookup( normName.getPrefix( 1 ) ); Attribute objectClass = attrs.get( "objectClass" ); if ( objectClass.contains( "alias" ) ) { @@ -221,7 +221,7 @@ assertHasEntry( msg, dn ); // check to see if target entry exists - Name target = dn.getSuffix( 1 ).add( newRdn ); + Name target = dn.getPrefix( 1 ).add( newRdn ); if ( nexus.hasEntry( target ) ) { LdapNameAlreadyBoundException e = null; Index: apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java =================================================================== --- apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java (revision 168355) +++ apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java (working copy) @@ -163,7 +163,7 @@ attribute.add( DateUtils.getGeneralizedTime() ); attributes.put( attribute ); - Name newDn = call.getName().getSuffix( 1 ).add( call.getNewRelativeName() ); + Name newDn = call.getName().getPrefix( 1 ).add( call.getNewRelativeName() ); nexus.modify( newDn, DirContext.REPLACE_ATTRIBUTE, attributes ); }