Merged back the trunk into my branch

git-svn-id: https://svn.apache.org/repos/asf/directory/apacheds/branches/apacheds-AP@1059098 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core-api/src/main/java/org/apache/directory/server/core/PasswordPolicyConfiguration.java b/core-api/src/main/java/org/apache/directory/server/core/PasswordPolicyConfiguration.java
index 6ffe638..c890dc0 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/PasswordPolicyConfiguration.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/PasswordPolicyConfiguration.java
@@ -49,7 +49,7 @@
      *  Default value is 0, does not expire.  If not 0, the value must be greater than or equal
      *  to the value of the pwdMinAge.
      */
-    private int pwdMaxAge;
+    private int pwdMaxAge = 0;
 
     /**
      *  specifies the maximum number of used passwords stored in the pwdHistory attribute.
@@ -97,7 +97,7 @@
      * consecutive failed bind attempts. The maximum number of consecutive
      * failed bind attempts is specified in {@link #pwdMaxFailure}
      */
-    private boolean pwdLockout;
+    private boolean pwdLockout = false;
 
     /**
      * the number of seconds that the password cannot be used to authenticate due to 
@@ -111,13 +111,13 @@
      * be used to authenticate.
      * Default value is 0, no limit on the number of authentication failures
      */
-    private int pwdMaxFailure;
+    private int pwdMaxFailure = 0;
 
     /**
      * the number of seconds after which the password failures are purged from the failure counter.
      * Default value is 0, reset all pwdFailureTimes after a successful authentication.
      */
-    private int pwdFailureCountInterval;
+    private int pwdFailureCountInterval = 0;
 
     /** 
      * flag to indicate if the password must be changed by the user after they bind to the 
@@ -143,13 +143,13 @@
     private int pwdMinDelay = 0;
 
     /** the maximum number of seconds to delay when responding to a failed authentication attempt.*/
-    private int pwdMaxDelay;
+    private int pwdMaxDelay = 0;
 
     /** 
      * the number of seconds an account may remain unused before it becomes locked
      * Default value is 0, no check for idle time.
      */
-    private int pwdMaxIdle;
+    private int pwdMaxIdle = 0;
 
 
     public String getPwdAttribute()
@@ -473,7 +473,7 @@
             sb.append( ++errCount ).append( ". password failure count interval time cannot be negative\n" );
         }
 
-        if ( ( ( pwdMinDelay > 0 ) && ( pwdMaxDelay <= 0 ) ) 
+        if ( ( ( pwdMinDelay > 0 ) && ( pwdMaxDelay <= 0 ) )
             || ( ( pwdMaxDelay > 0 ) && ( pwdMinDelay <= 0 ) ) )
         {
             sb
diff --git a/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java b/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
index 809197b..52b3190 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
@@ -75,7 +75,7 @@
         }
         catch ( Exception e )
         {
-            e.printStackTrace();
+            throw new LdapOtherException( e.getMessage() );
         }
         finally
         {
diff --git a/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java b/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
index ed133eb..114a901 100644
--- a/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
+++ b/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
@@ -689,13 +689,13 @@
         list.add( new DefaultAuthorizationInterceptor() );
         list.add( new AdministrativePointInterceptor() );
         list.add( new ExceptionInterceptor() );
-        list.add( new ChangeLogInterceptor() );
         list.add( new OperationalAttributeInterceptor() );
         list.add( new SchemaInterceptor() );
         list.add( new CollectiveAttributeInterceptor() );
         list.add( new SubentryInterceptor() );
         list.add( new EventInterceptor() );
         list.add( new TriggerInterceptor() );
+        list.add( new ChangeLogInterceptor() );
         list.add( new JournalInterceptor() );
 
         setInterceptors( list );
diff --git a/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java b/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
index 79db9a2..402f24d 100644
--- a/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
+++ b/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
@@ -98,13 +98,11 @@
     // -----------------------------------------------------------------------
     // Overridden (only change inducing) intercepted methods
     // -----------------------------------------------------------------------
-    
-
     public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
         next.add( addContext );
 
-        if ( ! changeLog.isEnabled() || ! addContext.isFirstOperation() )
+        if ( !changeLog.isEnabled() )
         {
             return;
         }
@@ -143,14 +141,14 @@
         // must save the entry if change log is enabled
         Entry serverEntry = null;
 
-        if ( changeLog.isEnabled() && deleteContext.isFirstOperation() )
+        if ( changeLog.isEnabled() )
         {
             serverEntry = getAttributes( deleteContext );
         }
 
         next.delete( deleteContext );
 
-        if ( ! changeLog.isEnabled() || ! deleteContext.isFirstOperation() )
+        if ( !changeLog.isEnabled() )
         {
             return;
         }
@@ -220,7 +218,7 @@
         Modification modification = ServerEntryUtils.getModificationItem( modifyContext.getModItems(), entryDeleted );
         boolean isDelete = ( modification != null );
 
-        if ( ! isDelete && ( changeLog.isEnabled() && modifyContext.isFirstOperation() ) )
+        if ( !isDelete && ( changeLog.isEnabled() ) )
         {
             // @todo make sure we're not putting in operational attributes that cannot be user modified
             serverEntry = getAttributes( modifyContext );
@@ -242,7 +240,6 @@
         if ( 
             isDelete ||   
             ! changeLog.isEnabled() || 
-            ! modifyContext.isFirstOperation() ||
             
          // if there are no modifications due to stripping out bogus non-
          // existing attributes then we will have no modification items and
@@ -307,7 +304,7 @@
         // After this point, the entry has been modified. The cloned entry contains
         // the modified entry, the originalEntry has changed
 
-        if ( ! changeLog.isEnabled() || ! renameContext.isFirstOperation() )
+        if ( !changeLog.isEnabled() )
         {
             return;
         }
@@ -330,7 +327,7 @@
     {
         Entry serverEntry = null;
         
-        if ( changeLog.isEnabled() && moveAndRenameContext.isFirstOperation() )
+        if ( changeLog.isEnabled() )
         {
             // @todo make sure we're not putting in operational attributes that cannot be user modified
             serverEntry = moveAndRenameContext.getOriginalEntry();
@@ -338,7 +335,7 @@
 
         next.moveAndRename( moveAndRenameContext );
 
-        if ( ! changeLog.isEnabled() || ! moveAndRenameContext.isFirstOperation() )
+        if ( !changeLog.isEnabled() )
         {
             return;
         }
@@ -371,7 +368,7 @@
     {
         next.move( moveContext );
 
-        if ( ! changeLog.isEnabled() || ! moveContext.isFirstOperation() )
+        if ( !changeLog.isEnabled() )
         {
             return;
         }
diff --git a/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java b/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
index f24f111..9143d83 100644
--- a/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
+++ b/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
@@ -1540,14 +1540,15 @@
 
                 if ( ( schema != null ) && schema.isEnabled() )
                 {
-                    String ocName = entry.get( MetaSchemaConstants.M_NAME_AT ).getString();
-                    ObjectClass addedOC = schemaManager.getObjectClassRegistry().lookup( ocName );
+                    EntryAttribute oidAT = entry.get( MetaSchemaConstants.M_OID_AT );                    
+                    String ocOid = oidAT.getString();
+                    
+                    ObjectClass addedOC = schemaManager.getObjectClassRegistry().lookup( ocOid );
                     computeSuperior( addedOC );
                 }
             }
             else if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.META_ATTRIBUTE_TYPE_OC ) )
             {
-
                 // This is an AttributeType addition
                 next.add( addContext );
             }