directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r567238 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
Date Sat, 18 Aug 2007 05:32:57 GMT
Author: akarasulu
Date: Fri Aug 17 22:32:56 2007
New Revision: 567238

URL: http://svn.apache.org/viewvc?view=rev&rev=567238
Log:
Fix for DIRSERVER-840: Double modification on a modify ?

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

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=567238&r1=567237&r2=567238
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
Fri Aug 17 22:32:56 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.operational;
 
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -171,27 +173,34 @@
     public void modify( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
-        nextInterceptor.modify( opContext );
-
-        if ( opContext.getDn().getNormName().equals( subschemaSubentryDn.getNormName() )
) 
-        {
-            return;
-        }
+        // -------------------------------------------------------------------
+        // Add the operational attributes for the modifier first
+        // -------------------------------------------------------------------
+
+        ModifyOperationContext context = ( ModifyOperationContext ) opContext;
+        List<ModificationItemImpl> modItemList = 
+            new ArrayList<ModificationItemImpl>( context.getModItems().length + 2 );
+        Collections.addAll( modItemList, context.getModItems() );
         
-        // add operational attributes after call in case the operation fails
-        Attributes attributes = new AttributesImpl( true );
         Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
         attribute.add( getPrincipal().getName() );
-        attributes.put( attribute );
-
+        modItemList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute
) );
+        
         attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
-        attributes.put( attribute );
-        
-        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes,
DirContext.REPLACE_ATTRIBUTE );
+        modItemList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute
) );
+
+        // -------------------------------------------------------------------
+        // Make the modify() call happen
+        // -------------------------------------------------------------------
+
+        nextInterceptor.modify( opContext );
 
-        ModifyOperationContext newModify = new ModifyOperationContext( opContext.getDn(),
items );
-        nexus.modify( newModify );
+        // Don't know why this was here! TODO Remove if no errors result
+//        if ( opContext.getDn().getNormName().equals( subschemaSubentryDn.getNormName()
) ) 
+//        {
+//            return;
+//        }
     }
 
 



Mime
View raw message