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 2007/01/25 15:23:56 UTC

svn commit: r499802 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java

Author: elecharny
Date: Thu Jan 25 06:23:55 2007
New Revision: 499802

URL: http://svn.apache.org/viewvc?view=rev&rev=499802
Log:
Applied a reverted version of Bastiaan Bakker patch.
If the AuthorizationService is not set or incorrect, we now throw
an exception.

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?view=diff&rev=499802&r1=499801&r2=499802
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Thu Jan 25 06:23:55 2007
@@ -38,6 +38,7 @@
 import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.configuration.StartupConfiguration;
+import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.jndi.AbstractContextFactory;
 import org.apache.directory.server.core.jndi.DeadContext;
@@ -545,8 +546,26 @@
             attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
 
             partitionNexus.add(normName, attributes );
-            AuthorizationService authzSrvc = ( AuthorizationService ) interceptorChain.get( "authorizationService" );
+            
+            Interceptor authzInterceptor = interceptorChain.get( "authorizationService" );
+            
+            if ( authzInterceptor == null )
+            {
+                log.error( "The Authorization service is null : this is not allowed" );
+                throw new NamingException( "The Authorization service is null" );
+            }
+            
+            if ( !( authzInterceptor instanceof AuthorizationService) )
+            {
+                log.error( "The Authorization service is not set correctly : '{}' is an incorect interceptor", 
+                    authzInterceptor.getClass().getName() );
+                throw new NamingException( "The Authorization service is incorrectly set" );
+                
+            }
+
+            AuthorizationService authzSrvc = ( AuthorizationService ) authzInterceptor;
             authzSrvc.cacheNewGroup( upName, normName, attributes );
+
         }
 
         // -------------------------------------------------------------------