directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1071833 - in /directory: apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/branches/m1...
Date Thu, 17 Feb 2011 23:15:58 GMT
Author: elecharny
Date: Thu Feb 17 23:15:57 2011
New Revision: 1071833

URL: http://svn.apache.org/viewvc?rev=1071833&view=rev
Log:
Used getParent() instead of remove() in many places in the server

Modified:
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
    directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
    directory/apacheds/branches/m1/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
    directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/branches/m1/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
    directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifRevertor.java
    directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -68,8 +68,7 @@ public class AttributeTypeSynchronizer e
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=attributetypes,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
@@ -144,8 +143,7 @@ public class AttributeTypeSynchronizer e
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=attributetypes,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
@@ -206,8 +204,7 @@ public class AttributeTypeSynchronizer e
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
         // Inject the new Dn
-        Dn newDn = targetEntry.getDn();
-        newDn = newDn.remove( newDn.size() - 1 );
+        Dn newDn = targetEntry.getDn().getParent();
         newDn = newDn.add( newRdn );
         targetEntry.setDn( newDn );
 

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -100,8 +100,7 @@ public class ComparatorSynchronizer exte
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=comparators,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.COMPARATOR );
@@ -148,8 +147,7 @@ public class ComparatorSynchronizer exte
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=comparators,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.COMPARATOR );
@@ -247,8 +245,7 @@ public class ComparatorSynchronizer exte
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
             // Inject the new Dn
-            Dn newDn = targetEntry.getDn();
-            newDn = newDn.remove( newDn.size() - 1 );
+            Dn newDn = targetEntry.getDn().getParent();
             newDn = newDn.add( newRdn );
             targetEntry.setDn( newDn );
 

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -97,8 +97,7 @@ public class MatchingRuleSynchronizer ex
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=matchingrules,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.MATCHING_RULE );
@@ -145,8 +144,7 @@ public class MatchingRuleSynchronizer ex
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=matchingrules,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.MATCHING_RULE );

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -99,8 +99,7 @@ public class NormalizerSynchronizer exte
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=normalizers,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.NORMALIZER );
@@ -157,8 +156,7 @@ public class NormalizerSynchronizer exte
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=normalizers,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.NORMALIZER );
@@ -219,8 +217,7 @@ public class NormalizerSynchronizer exte
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
             // Inject the new Dn
-            Dn newDn = targetEntry.getDn();
-            newDn = newDn.remove( newDn.size() - 1 );
+            Dn newDn = targetEntry.getDn().getParent();
             newDn = newDn.add( newRdn );
             targetEntry.setDn( newDn );
 

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -93,8 +93,7 @@ public class ObjectClassSynchronizer ext
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=objectclasses,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.OBJECT_CLASS );
@@ -142,8 +141,7 @@ public class ObjectClassSynchronizer ext
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=objectclasses,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.OBJECT_CLASS );
@@ -213,8 +211,7 @@ public class ObjectClassSynchronizer ext
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
         // Inject the new Dn
-        Dn newDn = targetEntry.getDn();
-        newDn = newDn.remove( newDn.size() - 1 );
+        Dn newDn = targetEntry.getDn().getParent();
         newDn = newDn.add( newRdn );
 
         checkOidIsUnique( newOid );

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxCheckerSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -34,8 +34,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.model.schema.registries.Schema;
 import org.apache.directory.shared.ldap.model.schema.registries.Registries;
+import org.apache.directory.shared.ldap.model.schema.registries.Schema;
 import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -98,8 +98,7 @@ public class SyntaxCheckerSynchronizer e
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=syntaxcheckers,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.SYNTAX_CHECKER );
@@ -145,8 +144,7 @@ public class SyntaxCheckerSynchronizer e
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=syntaxcheckers,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.SYNTAX_CHECKER );

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SyntaxSynchronizer.java
Thu Feb 17 23:15:57 2011
@@ -100,8 +100,7 @@ public class SyntaxSynchronizer extends 
     public void add( Entry entry ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=syntaxes,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.SYNTAX );
@@ -200,8 +199,7 @@ public class SyntaxSynchronizer extends 
     public void delete( Entry entry, boolean cascade ) throws LdapException
     {
         Dn dn = entry.getDn();
-        Dn parentDn = dn;
-        parentDn = parentDn.remove( parentDn.size() - 1 );
+        Dn parentDn = dn.getParent();
 
         // The parent Dn must be ou=syntaxes,cn=<schemaName>,ou=schema
         checkParent( parentDn, schemaManager, SchemaConstants.SYNTAX );

Modified: directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Thu Feb 17 23:15:57 2011
@@ -75,8 +75,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
 import org.apache.directory.shared.ldap.codec.controls.cascade.CascadeDecorator;
 import org.apache.directory.shared.ldap.codec.controls.manageDsaIT.ManageDsaITDecorator;
-
-// @TODO - all these controls should not be imported !!!! ALEX !!!
 import org.apache.directory.shared.ldap.codec.controls.search.entryChange.EntryChangeDecorator;
 import org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
 import org.apache.directory.shared.ldap.codec.controls.search.persistentSearch.PersistentSearchDecorator;
@@ -1227,25 +1225,11 @@ public abstract class ServerContext impl
         // calculate parents
         Dn oldParent = oldDn;
 
-        try
-        {
-            oldParent = oldParent.remove( oldDn.size() - 1 );
-        }
-        catch ( LdapInvalidDnException lide )
-        {
-            throw new NamingException( I18n.err( I18n.ERR_313, lide.getMessage() ) );
-        }
+        oldParent = oldParent.getParent();
 
         Dn newParent = newDn;
 
-        try
-        {
-            newParent = newParent.remove( newDn.size() - 1 );
-        }
-        catch ( LdapInvalidDnException lide )
-        {
-            throw new NamingException( I18n.err( I18n.ERR_313, lide.getMessage() ) );
-        }
+        newParent = newParent.getParent();
 
 
         Rdn oldRdn = oldDn.getRdn();

Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Thu Feb 17 23:15:57 2011
@@ -790,10 +790,8 @@ public class DefaultDirectoryService imp
         }
 
         // calculate parents
-        Dn oldBase = oldDn;
-        oldBase = oldBase.remove( oldDn.size() - 1 );
-        Dn newBase = newDn;
-        newBase = newBase.remove( newDn.size() - 1 );
+        Dn oldBase = oldDn.getParent();
+        Dn newBase = newDn.getParent();
 
         // Compute the Rdn for each of the Dn
         Rdn newRdn = newDn.getRdn( newDn.size() - 1 );
@@ -813,8 +811,7 @@ public class DefaultDirectoryService imp
         }
         else
         {
-            Dn target = newDn;
-            target = target.remove( newDn.size() - 1 );
+            Dn target = newDn.getParent();
 
             if ( newRdn.equals( oldRdn ) )
             {

Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
(original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
Thu Feb 17 23:15:57 2011
@@ -866,8 +866,7 @@ public class DefaultOperationManager imp
             // Inject the new Dn into the context
             if ( !dn.isEmpty() )
             {
-                Dn newDn = dn;
-                newDn = newDn.remove( dn.size() - 1 );
+                Dn newDn = dn.getParent();
                 newDn = newDn.add( renameContext.getNewRdn() );
                 renameContext.setNewDn( newDn );
             }

Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Thu Feb 17 23:15:57 2011
@@ -363,8 +363,7 @@ public class AciAuthorizationInterceptor
          */
         if ( oc.contains( SchemaConstants.SUBENTRY_OC ) )
         {
-            Dn parentDn = dn;
-            parentDn = parentDn.remove( dn.size() - 1 );
+            Dn parentDn = dn.getParent();
             originalEntry = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
         }
 

Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
(original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
Thu Feb 17 23:15:57 2011
@@ -143,8 +143,7 @@ public class ExceptionInterceptor extend
             return;
         }
 
-        Dn parentDn = name;
-        parentDn = parentDn.remove( name.size() - 1 );
+        Dn parentDn = name.getParent();
 
         // check if we're trying to add to a parent that is an alias
         boolean notAnAlias;

Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
(original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
Thu Feb 17 23:15:57 2011
@@ -60,8 +60,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.trigger.ActionTime;
 import org.apache.directory.shared.ldap.trigger.LdapOperation;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
-import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification.SPSpec;
+import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -126,8 +126,7 @@ public class TriggerInterceptor extends 
          */
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
-            Dn parentDn = dn;
-            parentDn = parentDn.remove( dn.size() - 1 );
+            Dn parentDn = dn.getParent();
 
             entry = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
         }
@@ -375,8 +374,7 @@ public class TriggerInterceptor extends 
 
         // @TODO : To be completely reviewed !!!
         Rdn oldRdn = name.getRdn();
-        Dn oldSuperiorDn = (Dn) name;
-        oldSuperiorDn = oldSuperiorDn.remove( oldSuperiorDn.size() - 1 );
+        Dn oldSuperiorDn = name.getParent();
         Dn newSuperiorDn = oldSuperiorDn;
         Dn oldDn = name;
         Dn newDn = name;
@@ -420,8 +418,7 @@ public class TriggerInterceptor extends 
         Entry movedEntry = moveAndRenameContext.getOriginalEntry();
 
         Rdn oldRdn = oldDn.getRdn();
-        Dn oldSuperiorDn = oldDn;
-        oldSuperiorDn = oldSuperiorDn.remove( oldSuperiorDn.size() - 1 );
+        Dn oldSuperiorDn = oldDn.getParent();
         Dn oldDN = oldDn;
         Dn newDn = moveAndRenameContext.getNewDn();
 

Modified: directory/apacheds/branches/m1/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
(original)
+++ directory/apacheds/branches/m1/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
Thu Feb 17 23:15:57 2011
@@ -1043,7 +1043,7 @@ public class SingleFileLdifPartitionTest
                             true );
 
                         partition.rename( renameOpCtx );
-                        tmpDn = dn.remove( dn.size() - 1 );
+                        tmpDn = dn.getParent();
                         tmpDn = tmpDn.add( newRdn );
                         tmpRdn = oldRdn;
 

Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
(original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
Thu Feb 17 23:15:57 2011
@@ -45,7 +45,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.exception.LdapOperationException;
 import org.apache.directory.shared.ldap.model.exception.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.model.exception.OperationAbandonedException;
@@ -1599,14 +1598,7 @@ public class SearchHandler extends LdapR
         Entry farthestReferralAncestor = null;
         Dn dn = target;
 
-        try
-        {
-            dn = dn.remove( dn.size() - 1 );
-        }
-        catch ( LdapInvalidDnException e2 )
-        {
-            // never thrown
-        }
+        dn = dn.getParent();
 
         while ( !dn.isEmpty() )
         {
@@ -1624,21 +1616,14 @@ public class SearchHandler extends LdapR
                     farthestReferralAncestor = entry;
                 }
 
-                dn = dn.remove( dn.size() - 1 );
+                dn = dn.getParent();
             }
             catch ( LdapException e )
             {
                 LOG.debug( "Entry for {} not found.", dn );
 
                 // update the Dn as we strip last component
-                try
-                {
-                    dn = dn.remove( dn.size() - 1 );
-                }
-                catch ( LdapInvalidDnException e1 )
-                {
-                    // never happens
-                }
+                dn = dn.getParent();
             }
         }
 

Modified: directory/apacheds/branches/m1/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/apacheds/branches/m1/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
(original)
+++ directory/apacheds/branches/m1/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
Thu Feb 17 23:15:57 2011
@@ -1874,13 +1874,11 @@ public abstract class AbstractStore<E, I
          * 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;
-        ancestorDn = ancestorDn.remove( aliasDn.size() - 1 );
+        ancestorDn = aliasDn.getParent();
         ancestorId = getEntryId( ancestorDn );
 
         // check if alias parent and aliased entry are the same
-        Dn normalizedAliasTargetParentDn = normalizedAliasTargetDn;
-        normalizedAliasTargetParentDn = normalizedAliasTargetParentDn.remove( normalizedAliasTargetDn.size()
- 1 );
+        Dn normalizedAliasTargetParentDn = normalizedAliasTargetDn.getParent();
 
         if ( !aliasDn.isDescendantOf( normalizedAliasTargetParentDn ) )
         {
@@ -1904,7 +1902,7 @@ public abstract class AbstractStore<E, I
                 subAliasIdx.add( ancestorId, targetId );
             }
 
-            ancestorDn = ancestorDn.remove( ancestorDn.size() - 1 );
+            ancestorDn = ancestorDn.getParent();
             ancestorId = getEntryId( ancestorDn );
         }
     }
@@ -1933,8 +1931,7 @@ public abstract class AbstractStore<E, I
 
         Dn aliasDn = getEntryDn( aliasId );
 
-        Dn ancestorDn = aliasDn;
-        ancestorDn = ancestorDn.remove( aliasDn.size() - 1 );
+        Dn ancestorDn = aliasDn.getParent();
         ID ancestorId = getEntryId( ancestorDn );
 
         /*

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifRevertor.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifRevertor.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifRevertor.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifRevertor.java
Thu Feb 17 23:15:57 2011
@@ -285,7 +285,7 @@ public final class LdifRevertor
 
         currentParent = modifiedDn;
         currentRdn = currentParent.getRdn();
-        currentParent = currentParent.remove( currentParent.size() - 1 );
+        currentParent = currentParent.getParent();;
 
         newDn = newSuperiorDn;
         newDn = newDn.add( modifiedDn.getRdn() );
@@ -334,7 +334,7 @@ public final class LdifRevertor
         {
             Dn oldSuperior = entry.getDn();
 
-            oldSuperior = oldSuperior.remove( oldSuperior.size() - 1 );
+            oldSuperior = oldSuperior.getParent();
             reverted.setNewSuperior( oldSuperior.getName() );
         }
 
@@ -399,7 +399,7 @@ public final class LdifRevertor
         {
             Dn oldSuperior = newDn;
 
-            oldSuperior = oldSuperior.remove( oldSuperior.size() - 1 );
+            oldSuperior = oldSuperior.getParent();
             reverted.setNewSuperior( oldSuperior.getName() );
         }
 
@@ -465,7 +465,7 @@ public final class LdifRevertor
         Rdn oldRdn = parentDn.getRdn();
 
         newDn = parentDn;
-        newDn = newDn.remove( newDn.size() - 1 );
+        newDn = newDn.getParent();
         newDn = newDn.add( newRdn );
 
         List<LdifEntry> entries = new ArrayList<LdifEntry>( 1 );

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java?rev=1071833&r1=1071832&r2=1071833&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java
Thu Feb 17 23:15:57 2011
@@ -20,6 +20,9 @@
 package org.apache.directory.shared.ldap.model.name;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.util.Chars;
@@ -27,9 +30,6 @@ import org.apache.directory.shared.util.
 import org.apache.directory.shared.util.Position;
 import org.apache.directory.shared.util.Unicode;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Utility class used by the Dn Parser.
  * 
@@ -37,8 +37,6 @@ import java.util.List;
  */
 public final class DnUtils
 {
-    // ~ Static fields/initializers
-    // -----------------------------------------------------------------
     /** A value if we got an error while parsing */
     public static final int PARSING_ERROR = -1;
 



Mime
View raw message