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 2012/09/20 18:04:28 UTC

svn commit: r1388091 - in /directory/apacheds/branches/apacheds-mvbt: core-api/src/main/java/org/apache/directory/server/core/api/partition/ core-shared/src/main/java/org/apache/directory/server/core/shared/ core-shared/src/main/java/org/apache/directo...

Author: elecharny
Date: Thu Sep 20 16:04:27 2012
New Revision: 1388091

URL: http://svn.apache.org/viewvc?rev=1388091&view=rev
Log:
Called the Dn.apply( SchemaManager ) method without testing if the Dn is already schema aware (this check is done in the apply() method)

Modified:
    directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java
    directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
    directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
    directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/branches/apacheds-mvbt/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
    directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java

Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java Thu Sep 20 16:04:27 2012
@@ -188,10 +188,7 @@ public abstract class AbstractPartition 
 
         this.suffixDn = suffixDn;
 
-        if ( schemaManager != null )
-        {
-            this.suffixDn.apply( schemaManager );
-        }
+        this.suffixDn.apply( schemaManager );
     }
 
 

Modified: directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java Thu Sep 20 16:04:27 2012
@@ -114,10 +114,7 @@ public class DefaultDnFactory implements
         }
         else
         {
-            if ( !cachedDn.isSchemaAware() && ( schemaManager != null ) )
-            {
-                cachedDn.apply( schemaManager );
-            }
+            cachedDn.apply( schemaManager );
 
             if ( enableStats )
             {

Modified: directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java Thu Sep 20 16:04:27 2012
@@ -727,12 +727,7 @@ public class DefaultPartitionNexus exten
         }
 
         // Not sure we need this code...
-        if ( !base.isSchemaAware() )
-        {
-            System.out.println( "~~~~~~~~~~~~~~~~~~~~~~~~~~~> " );
-            new Exception().printStackTrace();
-            base.apply( schemaManager );
-        }
+        base.apply( schemaManager );
 
         // Normal case : do a search on the specific partition
         Partition backend = getPartition( base );

Modified: directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Thu Sep 20 16:04:27 2012
@@ -1194,10 +1194,7 @@ public class DefaultOperationManager imp
         // Normalize the searchContext Dn
         Dn dn = searchContext.getDn();
 
-        if ( !dn.isSchemaAware() )
-        {
-            dn.apply( directoryService.getSchemaManager() );
-        }
+        dn.apply( directoryService.getSchemaManager() );
 
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();

Modified: directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Thu Sep 20 16:04:27 2012
@@ -809,10 +809,7 @@ public class AciAuthorizationInterceptor
         LdapPrincipal principal = session.getEffectivePrincipal();
         Dn principalDn = principal.getDn();
 
-        if ( !principalDn.isSchemaAware() )
-        {
-            principalDn.apply( schemaManager );
-        }
+        principalDn.apply( schemaManager );
 
         // Bypass this interceptor if we disabled the AC subsystem or if the principal is the admin
         if ( isPrincipalAnAdministrator( principalDn ) || !directoryService.isAccessControlEnabled() )

Modified: directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Thu Sep 20 16:04:27 2012
@@ -26,7 +26,6 @@ import java.util.Set;
 import javax.naming.NoPermissionException;
 
 import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.shared.DefaultCoreSession;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InterceptorEnum;
@@ -46,6 +45,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
+import org.apache.directory.server.core.shared.DefaultCoreSession;
+import org.apache.directory.server.core.shared.partition.DefaultPartitionNexus;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -98,6 +99,7 @@ public class DefaultAuthorizationInterce
         }
     }
 
+
     /**
      * Creates a new instance of DefaultAuthorizationInterceptor.
      */
@@ -130,7 +132,8 @@ public class DefaultAuthorizationInterce
         // read in the administrators and cache their normalized names
         Set<String> newAdministrators = new HashSet<String>( 2 );
         Dn adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-        CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( schemaManager, adminDn, AuthenticationLevel.STRONG ),
+        CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( schemaManager, adminDn,
+            AuthenticationLevel.STRONG ),
             directoryService );
 
         Entry adminGroup = nexus.lookup( new LookupOperationContext( adminSession, ADMIN_GROUP_DN ) );
@@ -191,7 +194,7 @@ public class DefaultAuthorizationInterce
             throw new LdapNoPermissionException( msg );
         }
 
-        if ( dn.size() > 2 && !isAnAdministrator(principalDn) )
+        if ( dn.size() > 2 && !isAnAdministrator( principalDn ) )
         {
             if ( dn.isDescendantOf( ADMIN_SYSTEM_DN ) )
             {
@@ -456,14 +459,14 @@ public class DefaultAuthorizationInterce
                 LOG.error( msg );
                 throw new LdapNoPermissionException( msg );
             }
-    
+
             if ( dn.isDescendantOf( GROUPS_BASE_DN ) )
             {
                 String msg = I18n.err( I18n.ERR_24, principalDn.getName(), dn.getName() );
                 LOG.error( msg );
                 throw new LdapNoPermissionException( msg );
             }
-            
+
             if ( dn.isDescendantOf( USERS_BASE_DN ) )
             {
                 String msg = I18n.err( I18n.ERR_24, principalDn.getName(), dn.getName() );
@@ -493,7 +496,7 @@ public class DefaultAuthorizationInterce
                     throw new LdapNoPermissionException( msg );
                 }
 
-                if ( normalizedDn.isDescendantOf( GROUPS_BASE_DN ) || normalizedDn.isDescendantOf( USERS_BASE_DN ))
+                if ( normalizedDn.isDescendantOf( GROUPS_BASE_DN ) || normalizedDn.isDescendantOf( USERS_BASE_DN ) )
                 {
                     // allow for self reads
                     if ( normalizedDn.equals( principalDn ) )
@@ -530,10 +533,7 @@ public class DefaultAuthorizationInterce
         Dn principalDn = opContext.getSession().getEffectivePrincipal().getDn();
         Dn dn = entry.getDn();
 
-        if ( !dn.isSchemaAware() )
-        {
-            dn.apply( opContext.getSession().getDirectoryService().getSchemaManager() );
-        }
+        dn.apply( opContext.getSession().getDirectoryService().getSchemaManager() );
 
         // Admin users gets full access to all entries
         if ( isAnAdministrator( principalDn ) )
@@ -555,7 +555,8 @@ public class DefaultAuthorizationInterce
             // stuff this if in here instead of up in outer if to prevent
             // constant needless reexecution for all entries in other depths
 
-            if ( dn.isDescendantOf( ADMIN_SYSTEM_DN ) || dn.isDescendantOf( GROUPS_BASE_DN ) || dn.isDescendantOf( USERS_BASE_DN ))
+            if ( dn.isDescendantOf( ADMIN_SYSTEM_DN ) || dn.isDescendantOf( GROUPS_BASE_DN )
+                || dn.isDescendantOf( USERS_BASE_DN ) )
             {
                 return false;
             }

Modified: directory/apacheds/branches/apacheds-mvbt/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Thu Sep 20 16:04:27 2012
@@ -141,10 +141,7 @@ public class NormalizationInterceptor ex
      */
     public boolean compare( CompareOperationContext compareContext ) throws LdapException
     {
-        if ( !compareContext.getDn().isSchemaAware() )
-        {
-            compareContext.getDn().apply( schemaManager );
-        }
+        compareContext.getDn().apply( schemaManager );
 
         // Get the attributeType from the OID
         try
@@ -176,10 +173,7 @@ public class NormalizationInterceptor ex
     {
         Dn dn = deleteContext.getDn();
 
-        if ( !dn.isSchemaAware() )
-        {
-            dn.apply( schemaManager );
-        }
+        dn.apply( schemaManager );
 
         next( deleteContext );
     }
@@ -231,10 +225,7 @@ public class NormalizationInterceptor ex
      */
     public void modify( ModifyOperationContext modifyContext ) throws LdapException
     {
-        if ( !modifyContext.getDn().isSchemaAware() )
-        {
-            modifyContext.getDn().apply( schemaManager );
-        }
+        modifyContext.getDn().apply( schemaManager );
 
         if ( modifyContext.getModItems() != null )
         {
@@ -254,25 +245,10 @@ public class NormalizationInterceptor ex
      */
     public void move( MoveOperationContext moveContext ) throws LdapException
     {
-        if ( !moveContext.getDn().isSchemaAware() )
-        {
-            moveContext.getDn().apply( schemaManager );
-        }
-
-        if ( !moveContext.getOldSuperior().isSchemaAware() )
-        {
-            moveContext.getOldSuperior().apply( schemaManager );
-        }
-
-        if ( !moveContext.getNewSuperior().isSchemaAware() )
-        {
-            moveContext.getNewSuperior().apply( schemaManager );
-        }
-
-        if ( !moveContext.getNewDn().isSchemaAware() )
-        {
-            moveContext.getNewDn().apply( schemaManager );
-        }
+        moveContext.getDn().apply( schemaManager );
+        moveContext.getOldSuperior().apply( schemaManager );
+        moveContext.getNewSuperior().apply( schemaManager );
+        moveContext.getNewDn().apply( schemaManager );
 
         if ( !moveContext.getRdn().isSchemaAware() )
         {
@@ -293,20 +269,9 @@ public class NormalizationInterceptor ex
             moveAndRenameContext.getNewRdn().apply( schemaManager );
         }
 
-        if ( !moveAndRenameContext.getDn().isSchemaAware() )
-        {
-            moveAndRenameContext.getDn().apply( schemaManager );
-        }
-
-        if ( !moveAndRenameContext.getNewDn().isSchemaAware() )
-        {
-            moveAndRenameContext.getNewDn().apply( schemaManager );
-        }
-
-        if ( !moveAndRenameContext.getNewSuperiorDn().isSchemaAware() )
-        {
-            moveAndRenameContext.getNewSuperiorDn().apply( schemaManager );
-        }
+        moveAndRenameContext.getDn().apply( schemaManager );
+        moveAndRenameContext.getNewDn().apply( schemaManager );
+        moveAndRenameContext.getNewSuperiorDn().apply( schemaManager );
 
         next( moveAndRenameContext );
     }
@@ -318,18 +283,9 @@ public class NormalizationInterceptor ex
     public void rename( RenameOperationContext renameContext ) throws LdapException
     {
         // Normalize the new Rdn and the Dn if needed
-
-        if ( !renameContext.getDn().isSchemaAware() )
-        {
-            renameContext.getDn().apply( schemaManager );
-        }
-
+        renameContext.getDn().apply( schemaManager );
         renameContext.getNewRdn().apply( schemaManager );
-
-        if ( !renameContext.getNewDn().isSchemaAware() )
-        {
-            renameContext.getNewDn().apply( schemaManager );
-        }
+        renameContext.getNewDn().apply( schemaManager );
 
         // Push to the next interceptor
         next( renameContext );
@@ -343,10 +299,7 @@ public class NormalizationInterceptor ex
     {
         Dn dn = searchContext.getDn();
 
-        if ( !dn.isSchemaAware() )
-        {
-            dn.apply( schemaManager );
-        }
+        dn.apply( schemaManager );
 
         ExprNode filter = searchContext.getFilter();
 

Modified: directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Thu Sep 20 16:04:27 2012
@@ -148,10 +148,7 @@ public class LdifPartition extends Abstr
                 throw new LdapInvalidDnException( msg );
             }
 
-            if ( !suffixDn.isSchemaAware() )
-            {
-                suffixDn.apply( schemaManager );
-            }
+            suffixDn.apply( schemaManager );
 
             String suffixDirName = getFileName( suffixDn );
             suffixDirectory = new File( partitionDir, suffixDirName );

Modified: directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java Thu Sep 20 16:04:27 2012
@@ -116,10 +116,7 @@ public class SingleFileLdifPartition ext
                 throw new LdapInvalidDnException( msg );
             }
 
-            if ( !suffixDn.isSchemaAware() )
-            {
-                suffixDn.apply( schemaManager );
-            }
+            suffixDn.apply( schemaManager );
 
             super.doInit();
 

Modified: directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Thu Sep 20 16:04:27 2012
@@ -1218,6 +1218,7 @@ public class SearchHandler extends LdapR
             }
 
             handleIgnoringReferrals( session, req );
+
             return;
         }
         else
@@ -1248,6 +1249,7 @@ public class SearchHandler extends LdapR
             {
                 /* serious and needs handling */
                 handleException( session, req, e );
+
                 return;
             }
 
@@ -1294,6 +1296,7 @@ public class SearchHandler extends LdapR
                 catch ( Exception e )
                 {
                     handleException( session, req, e );
+
                     return;
                 }
 
@@ -1302,6 +1305,7 @@ public class SearchHandler extends LdapR
                     result.setDiagnosticMessage( "Entry not found." );
                     result.setResultCode( ResultCodeEnum.NO_SUCH_OBJECT );
                     session.getIoSession().write( req.getResultResponse() );
+
                     return;
                 }
 

Modified: directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java?rev=1388091&r1=1388090&r2=1388091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java Thu Sep 20 16:04:27 2012
@@ -237,10 +237,7 @@ public class PagedSearchContext
         {
             request.getBase().apply( schemaManager );
 
-            if ( !previousSearchRequest.getBase().isSchemaAware() )
-            {
-                previousSearchRequest.getBase().apply( schemaManager );
-            }
+            previousSearchRequest.getBase().apply( schemaManager );
 
             if ( !request.getBase().equals( previousSearchRequest.getBase() ) )
             {