directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r818557 - in /directory: apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/reg...
Date Thu, 24 Sep 2009 17:25:50 GMT
Author: elecharny
Date: Thu Sep 24 17:25:45 2009
New Revision: 818557

URL: http://svn.apache.org/viewvc?rev=818557&view=rev
Log:
One more fix for the rename method : the AT with a descendant can't be removed now

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java?rev=818557&r1=818556&r2=818557&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Thu Sep 24 17:25:45 2009
@@ -163,6 +163,15 @@
         
         if ( ( schema != null ) && schema.isEnabled() )
         {
+            // Check that the entry has no descendant
+            if ( atRegistry.hasDescendants( oldAt.getOid() ) )
+            {
+                String msg = "Cannot rename " + entry.getDn().getUpName() + " to " + newDn
+ 
+                    " as the later has descendants' AttributeTypes";
+                
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
+            }
+            
             atRegistry.unregister( oldAt.getOid() );
             atRegistry.register( at );
         }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java?rev=818557&r1=818556&r2=818557&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
Thu Sep 24 17:25:45 2009
@@ -233,11 +233,14 @@
         // Get the ancestor's descendant, if any
         Set<AttributeType> descendants = oidToDescendantSet.get( ancestor.getOid()
);
 
-        descendants.remove( attributeType );
-        
-        if ( descendants.size() == 0 )
+        if ( descendants != null )
         {
-            oidToDescendantSet.remove( descendants );
+            descendants.remove( attributeType );
+            
+            if ( descendants.size() == 0 )
+            {
+                oidToDescendantSet.remove( descendants );
+            }
         }
         
         try



Mime
View raw message