directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r951068 [5/6] - in /directory: apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/ apacheds/trunk/core-api/src/main/java/org/apac...
Date Thu, 03 Jun 2010 17:05:29 GMT
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java Thu Jun  3 17:05:26 2010
@@ -30,9 +30,10 @@ import javax.naming.directory.DirContext
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
@@ -111,7 +112,7 @@ public class SchemaSubentryManager
 
 
     public SchemaSubentryManager( SchemaManager schemaManager, SchemaLoader loader )
-        throws Exception
+        throws LdapException
     {
         this.schemaManager = schemaManager;
         this.subentryModifier = new SchemaSubentryModifier( schemaManager );
@@ -155,7 +156,7 @@ public class SchemaSubentryManager
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.schema.SchemaChangeManager#modifySchemaSubentry(org.apache.directory.server.core.interceptor.context.ModifyOperationContext, org.apache.directory.server.core.entry.Entry, org.apache.directory.server.core.entry.Entry, boolean)
      */
-    public void modifySchemaSubentry( ModifyOperationContext opContext, boolean doCascadeModify ) throws Exception 
+    public void modifySchemaSubentry( ModifyOperationContext opContext, boolean doCascadeModify ) throws LdapException 
     {
         for ( Modification mod : opContext.getModItems() )
         {
@@ -232,7 +233,7 @@ public class SchemaSubentryManager
      * schema partition
      */
     private void modifyRemoveOperation( ModifyOperationContext opContext, String opAttrOid, 
-        EntryAttribute mods ) throws Exception
+        EntryAttribute mods ) throws LdapException
     {
         int index = opAttr2handlerIndex.get( opAttrOid );
         
@@ -253,7 +254,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.delete( opContext, normalizerDescription );
                 }
+                
                 break;
+                
             case( SYNTAX_CHECKER_INDEX ):
                 SyntaxCheckerDescription[] syntaxCheckerDescriptions = parsers.parseSyntaxCheckers( mods );
                 
@@ -261,7 +264,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.delete( opContext, syntaxCheckerDescription );
                 }
+                
                 break;
+                
             case( SYNTAX_INDEX ):
                 LdapSyntax[] syntaxes = parsers.parseLdapSyntaxes( mods );
                 
@@ -269,7 +274,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, syntax );
                 }
+                
                 break;
+                
             case( MATCHING_RULE_INDEX ):
                 MatchingRule[] mrs = parsers.parseMatchingRules( mods );
                 
@@ -277,7 +284,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, mr );
                 }
+                
                 break;
+                
             case( ATTRIBUTE_TYPE_INDEX ):
                 AttributeType[] ats = parsers.parseAttributeTypes( mods );
                 
@@ -285,7 +294,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, at );
                 }
+                
                 break;
+                
             case( OBJECT_CLASS_INDEX ):
                 ObjectClass[] ocs = parsers.parseObjectClasses( mods );
 
@@ -293,7 +304,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, oc );
                 }
+                
                 break;
+                
             case( MATCHING_RULE_USE_INDEX ):
                 MatchingRuleUse[] mrus = parsers.parseMatchingRuleUses( mods );
                 
@@ -301,7 +314,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, mru );
                 }
+                
                 break;
+                
             case( DIT_STRUCTURE_RULE_INDEX ):
                 DITStructureRule[] dsrs = parsers.parseDitStructureRules( mods );
                 
@@ -309,7 +324,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, dsr );
                 }
+                
                 break;
+                
             case( DIT_CONTENT_RULE_INDEX ):
                 DITContentRule[] dcrs = parsers.parseDitContentRules( mods );
                 
@@ -317,7 +334,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, dcr );
                 }
+                
                 break;
+                
             case( NAME_FORM_INDEX ):
                 NameForm[] nfs = parsers.parseNameForms( mods );
                 
@@ -325,7 +344,9 @@ public class SchemaSubentryManager
                 {
                     subentryModifier.deleteSchemaObject( opContext, nf );
                 }
+                
                 break;
+                
             default:
                 throw new IllegalStateException( I18n.err( I18n.ERR_285, index ) );
         }
@@ -343,7 +364,7 @@ public class SchemaSubentryManager
      * schema partition
      */
     private void modifyAddOperation( ModifyOperationContext opContext, String opAttrOid, 
-        EntryAttribute mods, boolean doCascadeModify ) throws Exception
+        EntryAttribute mods, boolean doCascadeModify ) throws LdapException
     {
         if ( doCascadeModify )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Thu Jun  3 17:05:26 2010
@@ -34,6 +34,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -137,7 +138,7 @@ public class SchemaSubentryModifier
     }
     
 
-    public void add( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws Exception
+    public void add( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws LdapException
     {
         String schemaName = getSchema( comparatorDescription );   
         DN dn = new DN( 
@@ -152,7 +153,7 @@ public class SchemaSubentryModifier
     }
     
     
-    public void add( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
+    public void add( OperationContext opContext, NormalizerDescription normalizerDescription ) throws LdapException
     {
         String schemaName = getSchema( normalizerDescription );
         DN dn = new DN( 
@@ -167,7 +168,7 @@ public class SchemaSubentryModifier
     }
     
     
-    public void add( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
+    public void add( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws LdapException
     {
         String schemaName = getSchema( syntaxCheckerDescription );
         DN dn = new DN( 
@@ -181,7 +182,7 @@ public class SchemaSubentryModifier
     }
     
     
-    public void addSchemaObject( OperationContext opContext, SchemaObject obj ) throws Exception
+    public void addSchemaObject( OperationContext opContext, SchemaObject obj ) throws LdapException
     {
         Schema schema = schemaManager.getLoadedSchema( obj.getSchemaName() );
         DN dn = getDn( obj );
@@ -192,14 +193,14 @@ public class SchemaSubentryModifier
     }
 
 
-    public void deleteSchemaObject( OperationContext opContext, SchemaObject obj ) throws Exception
+    public void deleteSchemaObject( OperationContext opContext, SchemaObject obj ) throws LdapException
     {
         DN dn = getDn( obj );
         opContext.delete( dn, BYPASS );
     }
 
     
-    public void delete( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
+    public void delete( OperationContext opContext, NormalizerDescription normalizerDescription ) throws LdapException
     {
         String schemaName = getSchema( normalizerDescription );
         DN dn = new DN( 
@@ -212,7 +213,7 @@ public class SchemaSubentryModifier
     }
 
 
-    public void delete( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
+    public void delete( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws LdapException
     {
         String schemaName = getSchema( syntaxCheckerDescription );
         DN dn = new DN( 
@@ -224,7 +225,7 @@ public class SchemaSubentryModifier
     }
 
 
-    public void delete( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws Exception
+    public void delete( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws LdapException
     {
         String schemaName = getSchema( comparatorDescription );
         DN dn = new DN( 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Thu Jun  3 17:05:26 2010
@@ -64,8 +64,12 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
+import org.apache.directory.shared.ldap.exception.LdapOperationErrorException;
+import org.apache.directory.shared.ldap.exception.LdapOperationException;
+import org.apache.directory.shared.ldap.exception.LdapOtherException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -132,7 +136,7 @@ public class SubentryInterceptor extends
     private AttributeType objectClassType;
 
 
-    public void init( DirectoryService directoryService ) throws Exception
+    public void init( DirectoryService directoryService ) throws LdapException
     {
         super.init( directoryService );
         nexus = directoryService.getPartitionNexus();
@@ -178,32 +182,41 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry subentry = subentries.get();
-                DN dnName = subentry.getDn();
-
-                String subtree = subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
-                SubtreeSpecification ss;
-
-                try
-                {
-                    ss = ssParser.parse( subtree );
-                }
-                catch ( Exception e )
+                while ( subentries.next() )
                 {
-                    LOG.warn( "Failed while parsing subtreeSpecification for " + dnName );
-                    continue;
+                    Entry subentry = subentries.get();
+                    DN dnName = subentry.getDn();
+    
+                    String subtree = subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
+                    SubtreeSpecification ss;
+    
+                    try
+                    {
+                        ss = ssParser.parse( subtree );
+                    }
+                    catch ( Exception e )
+                    {
+                        LOG.warn( "Failed while parsing subtreeSpecification for " + dnName );
+                        continue;
+                    }
+    
+                    dnName.normalize( schemaManager.getNormalizerMapping() );
+                    subentryCache.setSubentry( dnName.getNormName(), ss, getSubentryTypes( subentry ) );
                 }
-
-                dnName.normalize( schemaManager.getNormalizerMapping() );
-                subentryCache.setSubentry( dnName.getNormName(), ss, getSubentryTypes( subentry ) );
+                
+                subentries.close();
+            }
+            catch ( Exception e )
+            {
+                throw new LdapOperationException( e.getMessage() );
             }
         }
     }
 
 
-    private int getSubentryTypes( Entry subentry ) throws Exception
+    private int getSubentryTypes( Entry subentry ) throws LdapException
     {
         int types = 0;
 
@@ -243,7 +256,7 @@ public class SubentryInterceptor extends
     // -----------------------------------------------------------------------
 
     public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext )
-        throws Exception
+        throws LdapException
     {
         EntryFilteringCursor cursor = nextInterceptor.list( opContext );
 
@@ -257,7 +270,7 @@ public class SubentryInterceptor extends
 
 
     public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext opContext )
-        throws Exception
+        throws LdapException
     {
         EntryFilteringCursor cursor = nextInterceptor.search( opContext );
 
@@ -289,7 +302,7 @@ public class SubentryInterceptor extends
      * @return true if subentries should be visible, false otherwise
      * @throws Exception if there are problems accessing request controls
      */
-    private boolean isSubentryVisible( OperationContext opContext ) throws Exception
+    private boolean isSubentryVisible( OperationContext opContext ) throws LdapException
     {
         if ( !opContext.hasRequestControls() )
         {
@@ -321,7 +334,7 @@ public class SubentryInterceptor extends
      * @return the set of subentry op attrs for an entry
      * @throws Exception if there are problems accessing entry information
      */
-    public Entry getSubentryAttributes( DN dn, Entry entryAttrs ) throws Exception
+    public Entry getSubentryAttributes( DN dn, Entry entryAttrs ) throws LdapException
     {
         Entry subentryAttrs = new DefaultEntry( schemaManager, dn );
         Iterator<String> list = subentryCache.nameIterator();
@@ -399,7 +412,7 @@ public class SubentryInterceptor extends
     }
 
 
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
         DN name = addContext.getDn();
         ClonedServerEntry entry = addContext.getEntry();
@@ -480,18 +493,25 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN dn = candidate.getDn();
-                dn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( addContext.getSession(), dn, getOperationalModsForAdd(
-                        candidate, operational ) ) );
+                    Entry candidate = subentries.get();
+                    DN dn = candidate.getDn();
+                    dn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( addContext.getSession(), dn, getOperationalModsForAdd(
+                            candidate, operational ) ) );
+                    }
                 }
             }
+            catch ( Exception e )
+            {
+                throw new LdapOtherException( e.getMessage() );
+            }
 
             // TODO why are we doing this here if we got the entry from the 
             // opContext in the first place - got to look into this 
@@ -585,7 +605,7 @@ public class SubentryInterceptor extends
     // Methods dealing subentry deletion
     // -----------------------------------------------------------------------
 
-    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
+    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws LdapException
     {
         DN name = opContext.getDn();
         Entry entry = opContext.getEntry();
@@ -623,17 +643,26 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN dn = new DN( candidate.getDn() );
-                dn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForRemove(
-                        name, candidate ) ) );
+                    Entry candidate = subentries.get();
+                    DN dn = new DN( candidate.getDn() );
+                    dn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForRemove(
+                            name, candidate ) ) );
+                    }
                 }
+                
+                subentries.close();
+            }
+            catch ( Exception e )
+            {
+                throw new LdapOperationException( e.getMessage() );
             }
         }
         else
@@ -656,7 +685,7 @@ public class SubentryInterceptor extends
      * are, false otherwise
      * @throws Exception if there are errors while searching the directory
      */
-    private boolean hasAdministrativeDescendant( OperationContext opContext, DN name ) throws Exception
+    private boolean hasAdministrativeDescendant( OperationContext opContext, DN name ) throws LdapException
     {
         ExprNode filter = new PresenceNode( "administrativeRole" );
         SearchControls controls = new SearchControls();
@@ -668,17 +697,25 @@ public class SubentryInterceptor extends
 
         EntryFilteringCursor aps = nexus.search( searchOperationContext );
 
-        if ( aps.next() )
+        try
+        { 
+            if ( aps.next() )
+            {
+                aps.close();
+                return true;
+            }
+        }
+        catch ( Exception e )
         {
-            aps.close();
-            return true;
+            throw new LdapOperationException( e.getMessage() );
         }
+        
 
         return false;
     }
 
 
-    private List<Modification> getModsOnEntryRdnChange( DN oldName, DN newName, Entry entry ) throws Exception
+    private List<Modification> getModsOnEntryRdnChange( DN oldName, DN newName, Entry entry ) throws LdapException
     {
         List<Modification> modList = new ArrayList<Modification>();
 
@@ -751,7 +788,7 @@ public class SubentryInterceptor extends
     }
 
 
-    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
+    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws LdapException
     {
         DN name = opContext.getDn();
 
@@ -791,17 +828,26 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN dn = candidate.getDn();
-                dn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace(
-                        name, newName, subentry, candidate ) ) );
+                    Entry candidate = subentries.get();
+                    DN dn = candidate.getDn();
+                    dn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace(
+                            name, newName, subentry, candidate ) ) );
+                    }
                 }
+                
+                subentries.close();
+            }
+            catch ( Exception e )
+            {
+                throw new LdapOperationException( e.getMessage() );
             }
         }
         else
@@ -829,7 +875,7 @@ public class SubentryInterceptor extends
     }
 
 
-    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws Exception
+    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws LdapException
     {
         DN oriChildName = opContext.getDn();
         DN parent = opContext.getParent();
@@ -870,17 +916,26 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN dn = candidate.getDn();
-                dn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace(
-                        oriChildName, newName, subentry, candidate ) ) );
+                    Entry candidate = subentries.get();
+                    DN dn = candidate.getDn();
+                    dn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace(
+                            oriChildName, newName, subentry, candidate ) ) );
+                    }
                 }
+                
+                subentries.close();
+            }
+            catch ( Exception e )
+            {
+                throw new LdapOperationException( e.getMessage() );
             }
         }
         else
@@ -909,7 +964,7 @@ public class SubentryInterceptor extends
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
+    public void move( NextInterceptor next, MoveOperationContext opContext ) throws LdapException
     {
         DN oriChildName = opContext.getDn();
         DN newParentName = opContext.getParent();
@@ -948,17 +1003,26 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN dn = candidate.getDn();
-                dn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace(
-                        oriChildName, newName, subentry, candidate ) ) );
+                    Entry candidate = subentries.get();
+                    DN dn = candidate.getDn();
+                    dn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace(
+                            oriChildName, newName, subentry, candidate ) ) );
+                    }
                 }
+                
+                subentries.close();
+            }
+            catch ( Exception e )
+            {
+                throw new LdapOperationException( e.getMessage() );
             }
         }
         else
@@ -990,7 +1054,7 @@ public class SubentryInterceptor extends
     // Methods dealing subentry modification
     // -----------------------------------------------------------------------
 
-    private int getSubentryTypes( Entry entry, List<Modification> mods ) throws Exception
+    private int getSubentryTypes( Entry entry, List<Modification> mods ) throws LdapException
     {
         EntryAttribute ocFinalState = entry.get( SchemaConstants.OBJECT_CLASS_AT ).clone();
 
@@ -1032,7 +1096,7 @@ public class SubentryInterceptor extends
     /**
      * {@inheritDoc}
      */
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws LdapException
     {
         DN dn = opContext.getDn();
         List<Modification> mods = opContext.getModItems();
@@ -1091,18 +1155,25 @@ public class SubentryInterceptor extends
 
             EntryFilteringCursor subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN candidateDn = candidate.getDn();
-                candidateDn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ssOld, apName, candidateDn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( opContext.getSession(), candidateDn,
-                        getOperationalModsForRemove( dn, candidate ) ) );
+                    Entry candidate = subentries.get();
+                    DN candidateDn = candidate.getDn();
+                    candidateDn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ssOld, apName, candidateDn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( opContext.getSession(), candidateDn,
+                            getOperationalModsForRemove( dn, candidate ) ) );
+                    }
                 }
             }
+            catch ( Exception e )
+            {
+                throw new LdapOperationErrorException( e.getMessage() );
+            }
 
             // search for all selected entries by the new SS and add references to subentry
             Subentry subentry = subentryCache.getSubentry( dn.getNormName() );
@@ -1115,18 +1186,25 @@ public class SubentryInterceptor extends
 
             subentries = nexus.search( searchOperationContext );
 
-            while ( subentries.next() )
+            try
             {
-                Entry candidate = subentries.get();
-                DN candidateDn = candidate.getDn();
-                candidateDn.normalize( schemaManager.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ssNew, apName, candidateDn, candidate ) )
+                while ( subentries.next() )
                 {
-                    nexus.modify( new ModifyOperationContext( opContext.getSession(), candidateDn,
-                        getOperationalModsForAdd( candidate, operational ) ) );
+                    Entry candidate = subentries.get();
+                    DN candidateDn = candidate.getDn();
+                    candidateDn.normalize( schemaManager.getNormalizerMapping() );
+    
+                    if ( evaluator.evaluate( ssNew, apName, candidateDn, candidate ) )
+                    {
+                        nexus.modify( new ModifyOperationContext( opContext.getSession(), candidateDn,
+                            getOperationalModsForAdd( candidate, operational ) ) );
+                    }
                 }
             }
+            catch ( Exception e )
+            {
+                throw new LdapOperationErrorException( e.getMessage() );
+            }
         }
         else
         {
@@ -1246,7 +1324,7 @@ public class SubentryInterceptor extends
      * @param subentry the subentry to get attributes from
      * @return the set of attributes to be added or removed from entries
      */
-    private Entry getSubentryOperatationalAttributes( DN name, Subentry subentry ) throws Exception
+    private Entry getSubentryOperatationalAttributes( DN name, Subentry subentry ) throws LdapException
     {
         Entry operational = new DefaultEntry( schemaManager, name );
 
@@ -1312,7 +1390,7 @@ public class SubentryInterceptor extends
      * @return the set of modifications required to remove an entry's reference to
      * a subentry
      */
-    private List<Modification> getOperationalModsForRemove( DN subentryDn, Entry candidate ) throws Exception
+    private List<Modification> getOperationalModsForRemove( DN subentryDn, Entry candidate ) throws LdapException
     {
         List<Modification> modList = new ArrayList<Modification>();
         String dn = subentryDn.getNormName();
@@ -1348,7 +1426,7 @@ public class SubentryInterceptor extends
      * @return the set of modifications needed to update the entry
      * @throws Exception if there are probelms accessing modification items
      */
-    public List<Modification> getOperationalModsForAdd( Entry entry, Entry operational ) throws Exception
+    public List<Modification> getOperationalModsForAdd( Entry entry, Entry operational ) throws LdapException
     {
         List<Modification> modList = new ArrayList<Modification>();
 
@@ -1443,7 +1521,7 @@ public class SubentryInterceptor extends
     }
 
 
-    private List<Modification> getModsOnEntryModification( DN name, Entry oldEntry, Entry newEntry ) throws Exception
+    private List<Modification> getModsOnEntryModification( DN name, Entry oldEntry, Entry newEntry ) throws LdapException
     {
         List<Modification> modList = new ArrayList<Modification>();
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java Thu Jun  3 17:05:26 2010
@@ -29,6 +29,7 @@ import java.util.Map;
 
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
@@ -77,7 +78,7 @@ public abstract class AbstractStoredProc
     
     
     public final List<Object> getArgumentsToInject( OperationContext opContext, 
-        List<StoredProcedureParameter> parameterList ) throws Exception
+        List<StoredProcedureParameter> parameterList ) throws LdapException
     {
         List<Object> arguments = new ArrayList<Object>();
         
@@ -96,7 +97,7 @@ public abstract class AbstractStoredProc
     
     MicroInjector $operationPrincipalInjector = new MicroInjector()
     {
-        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception
+        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException
         {
             return getOperationPrincipal();
         }
@@ -105,7 +106,7 @@ public abstract class AbstractStoredProc
     
     MicroInjector $ldapContextInjector = new MicroInjector()
     {
-        public Object inject(  OperationContext opContext, StoredProcedureParameter param ) throws Exception
+        public Object inject(  OperationContext opContext, StoredProcedureParameter param ) throws LdapException
         {
             Generic_LDAP_CONTEXT ldapCtxParam = ( Generic_LDAP_CONTEXT ) param;
             DN ldapCtxName = ldapCtxParam.getCtxName();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java Thu Jun  3 17:05:26 2010
@@ -22,11 +22,10 @@ package org.apache.directory.server.core
 
 import java.util.Map;
 
-import javax.naming.NamingException;
-
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
 
@@ -38,7 +37,7 @@ public class DeleteStoredProcedureParame
 
     
     public DeleteStoredProcedureParameterInjector( OperationContext opContext, DN deletedEntryName ) 
-        throws Exception
+        throws LdapException
     {
         super( opContext );
         this.deletedEntryName = deletedEntryName;
@@ -50,7 +49,7 @@ public class DeleteStoredProcedureParame
     
     MicroInjector $nameInjector = new MicroInjector()
     {
-        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception
+        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException
         {
             // Return a safe copy constructed with user provided name.
             return new DN( deletedEntryName.getName() );
@@ -59,14 +58,14 @@ public class DeleteStoredProcedureParame
     
     MicroInjector $deletedEntryInjector = new MicroInjector()
     {
-        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
+        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException
         {
             return deletedEntry;
         }
     };
     
 
-    private Entry getDeletedEntry( OperationContext opContext ) throws Exception
+    private Entry getDeletedEntry( OperationContext opContext ) throws LdapException
     {
         /**
          * Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Thu Jun  3 17:05:26 2010
@@ -27,8 +27,8 @@ import java.util.Map;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
-import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.name.DN;
@@ -42,7 +42,7 @@ public class ModifyStoredProcedureParame
     private Entry oldEntry;
     
     
-    public ModifyStoredProcedureParameterInjector( ModifyOperationContext opContext ) throws Exception
+    public ModifyStoredProcedureParameterInjector( ModifyOperationContext opContext ) throws LdapException
     {
         super( opContext );
         modifiedEntryName = opContext.getDn();
@@ -93,14 +93,14 @@ public class ModifyStoredProcedureParame
     
     MicroInjector $newEntryInjector = new MicroInjector()
     {
-        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception
+        public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException
         {
             return getEntry( opContext );
         }
     };
     
     
-    private Entry getEntry( OperationContext opContext ) throws Exception
+    private Entry getEntry( OperationContext opContext ) throws LdapException
     {
         /**
          * Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java Thu Jun  3 17:05:26 2010
@@ -23,6 +23,7 @@ package org.apache.directory.server.core
 import java.util.List;
 
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
 
 
@@ -35,11 +36,11 @@ import org.apache.directory.shared.ldap.
 public interface StoredProcedureParameterInjector
 {
     List<Object> getArgumentsToInject( OperationContext opContext, 
-        List<StoredProcedureParameter> parameterList ) throws Exception;
+        List<StoredProcedureParameter> parameterList ) throws LdapException;
     
     
     public interface MicroInjector
     {
-        Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception;
+        Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java Thu Jun  3 17:05:26 2010
@@ -21,9 +21,10 @@ package org.apache.directory.server.core
 
 
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.shared.ldap.exception.LdapException;
 
 
 public interface TriggerExecutionAuthorizer
 {
-    boolean hasPermission( OperationContext opContext ) throws Exception;
+    boolean hasPermission( OperationContext opContext ) throws LdapException;
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Thu Jun  3 17:05:26 2010
@@ -50,6 +50,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapOperationErrorException;
 import org.apache.directory.shared.ldap.exception.LdapOtherException;
 import org.apache.directory.shared.ldap.name.DN;
@@ -116,7 +117,7 @@ public class TriggerInterceptor extends 
      * @param proxy the partition nexus proxy 
      */
     private void addPrescriptiveTriggerSpecs( OperationContext opContext, List<TriggerSpecification> triggerSpecs,
-        DN dn, Entry entry ) throws Exception
+        DN dn, Entry entry ) throws LdapException
     {
 
         /*
@@ -160,7 +161,7 @@ public class TriggerInterceptor extends 
      * @param entry the target entry that is considered as the trigger source
      * @throws Exception if there are problems accessing attribute values
      */
-    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, Entry entry ) throws Exception
+    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, Entry entry ) throws LdapException
     {
         EntryAttribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR );
 
@@ -230,7 +231,7 @@ public class TriggerInterceptor extends 
     // Interceptor Overrides
     ////////////////////////////////////////////////////////////////////////////
 
-    public void init( DirectoryService directoryService ) throws Exception
+    public void init( DirectoryService directoryService ) throws LdapException
     {
         super.init( directoryService );
 
@@ -258,7 +259,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
         DN name = addContext.getDn();
         Entry entry = addContext.getEntry();
@@ -293,7 +294,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws Exception
+    public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws LdapException
     {
         DN name = deleteContext.getDn();
 
@@ -327,7 +328,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws LdapException
     {
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
@@ -361,7 +362,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws Exception
+    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
     {
         DN name = renameContext.getDn();
         RDN newRdn = renameContext.getNewRdn();
@@ -406,7 +407,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws Exception
+    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws LdapException
     {
         DN oriChildName = opContext.getDn();
         DN parent = opContext.getParent();
@@ -482,7 +483,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
+    public void move( NextInterceptor next, MoveOperationContext opContext ) throws LdapException
     {
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
@@ -562,7 +563,7 @@ public class TriggerInterceptor extends 
     ////////////////////////////////////////////////////////////////////////////
 
     private Object executeTriggers( OperationContext opContext, List<TriggerSpecification> triggerSpecs,
-        StoredProcedureParameterInjector injector ) throws Exception
+        StoredProcedureParameterInjector injector ) throws LdapException
     {
         Object result = null;
 
@@ -588,7 +589,7 @@ public class TriggerInterceptor extends 
 
 
     private Object executeTrigger( OperationContext opContext, TriggerSpecification tsec,
-        StoredProcedureParameterInjector injector ) throws Exception
+        StoredProcedureParameterInjector injector ) throws LdapException
     {
         List<Object> returnValues = new ArrayList<Object>();
         List<SPSpec> spSpecs = tsec.getSPSpecs();
@@ -605,7 +606,7 @@ public class TriggerInterceptor extends 
     }
 
 
-    private Object executeProcedure( OperationContext opContext, String procedure, Object[] values ) throws Exception
+    private Object executeProcedure( OperationContext opContext, String procedure, Object[] values ) throws LdapException
     {
 
         try

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Thu Jun  3 17:05:26 2010
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
@@ -44,11 +45,13 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.StringValue;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapOperationException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -92,7 +95,7 @@ public class TriggerSpecCache
      * @param directoryService the directory service core
      * @throws NamingException with problems initializing cache
      */
-    public TriggerSpecCache( DirectoryService directoryService ) throws Exception
+    public TriggerSpecCache( DirectoryService directoryService ) throws LdapException
     {
         this.nexus = directoryService.getPartitionNexus();
         final SchemaManager schemaManager = directoryService.getSchemaManager();
@@ -104,11 +107,12 @@ public class TriggerSpecCache
                     return schemaManager.getNormalizerMapping();
                 }
             });
+        
         initialize( directoryService );
     }
 
 
-    private void initialize( DirectoryService directoryService ) throws Exception
+    private void initialize( DirectoryService directoryService ) throws LdapException
     {
         // search all naming contexts for trigger subentenries
         // generate TriggerSpecification arrays for each subentry
@@ -134,29 +138,36 @@ public class TriggerSpecCache
             
             EntryFilteringCursor results = nexus.search( searchOperationContext );
             
-            while ( results.next() )
-            {
-                ClonedServerEntry resultEntry = results.get();
-                DN subentryDn = resultEntry.getDn();
-                EntryAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR );
-                
-                if ( triggerSpec == null )
+            try
+            { 
+                while ( results.next() )
                 {
-                    LOG.warn( "Found triggerExecutionSubentry '" + subentryDn + "' without any " + PRESCRIPTIVE_TRIGGER_ATTR );
-                    continue;
+                    ClonedServerEntry resultEntry = results.get();
+                    DN subentryDn = resultEntry.getDn();
+                    EntryAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR );
+                    
+                    if ( triggerSpec == null )
+                    {
+                        LOG.warn( "Found triggerExecutionSubentry '" + subentryDn + "' without any " + PRESCRIPTIVE_TRIGGER_ATTR );
+                        continue;
+                    }
+    
+                    DN normSubentryName = subentryDn.normalize( directoryService.getSchemaManager()
+                        .getNormalizerMapping() );
+                    subentryAdded( normSubentryName, resultEntry );
                 }
-
-                DN normSubentryName = subentryDn.normalize( directoryService.getSchemaManager()
-                    .getNormalizerMapping() );
-                subentryAdded( normSubentryName, resultEntry );
+                
+                results.close();
+            }
+            catch ( Exception e )
+            {
+                throw new LdapOperationException( e.getMessage() );
             }
-            
-            results.close();
         }
     }
 
 
-    private boolean hasPrescriptiveTrigger( Entry entry ) throws Exception
+    private boolean hasPrescriptiveTrigger( Entry entry ) throws LdapException
     {
         // only do something if the entry contains prescriptiveTrigger
         EntryAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
@@ -165,7 +176,7 @@ public class TriggerSpecCache
     }
 
 
-    public void subentryAdded( DN normName, Entry entry ) throws Exception
+    public void subentryAdded( DN normName, Entry entry ) throws LdapException
     {
         // only do something if the entry contains prescriptiveTrigger
         EntryAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
@@ -198,7 +209,7 @@ public class TriggerSpecCache
     }
 
 
-    public void subentryDeleted( DN normName, Entry entry ) throws Exception
+    public void subentryDeleted( DN normName, Entry entry ) throws LdapException
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {
@@ -209,7 +220,7 @@ public class TriggerSpecCache
     }
 
 
-    public void subentryModified( ModifyOperationContext opContext, Entry entry ) throws Exception
+    public void subentryModified( ModifyOperationContext opContext, Entry entry ) throws LdapException
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Thu Jun  3 17:05:26 2010
@@ -339,13 +339,13 @@ public class MaxImmSubFilterTest
         }
 
 
-        public ClonedServerEntry lookup( DN dn, Collection<String> bypass ) throws Exception
+        public ClonedServerEntry lookup( DN dn, Collection<String> bypass ) throws LdapException
         {
             return null;
         }
 
 
-        public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
+        public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws LdapException
         {
             return null;
         }
@@ -408,22 +408,22 @@ public class MaxImmSubFilterTest
         }
 
 
-        public void add( Entry entry, Collection<String> bypass ) throws Exception
+        public void add( Entry entry, Collection<String> bypass ) throws LdapException
         {
         }
 
 
-        public void delete( DN dn, Collection<String> bypass ) throws Exception
+        public void delete( DN dn, Collection<String> bypass ) throws LdapException
         {
         }
 
 
-        public void modify( DN dn, List<Modification> mods, Collection<String> bypass ) throws Exception
+        public void modify( DN dn, List<Modification> mods, Collection<String> bypass ) throws LdapException
         {
         }
 
 
-        public boolean hasEntry( DN dn, Collection<String> byPass ) throws Exception
+        public boolean hasEntry( DN dn, Collection<String> byPass ) throws LdapException
         {
             return false;
         }
@@ -809,7 +809,7 @@ public class MaxImmSubFilterTest
             return null;
         }
 
-        public CoreSession getAdminSession() throws Exception
+        public CoreSession getAdminSession()
         {
             return null;
         }
@@ -926,7 +926,7 @@ public class MaxImmSubFilterTest
             this.count = count;
         }
         
-        public void add( AddOperationContext opContext ) throws Exception
+        public void add( AddOperationContext opContext ) throws LdapException
         {
         }
 
@@ -936,68 +936,68 @@ public class MaxImmSubFilterTest
         }
 
         
-        public boolean compare( CompareOperationContext opContext ) throws Exception
+        public boolean compare( CompareOperationContext opContext ) throws LdapException
         {
             return false;
         }
 
 
-        public void delete( DeleteOperationContext opContext ) throws Exception
+        public void delete( DeleteOperationContext opContext ) throws LdapException
         {
         }
 
-        public DN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
+        public DN getMatchedName( GetMatchedNameOperationContext opContext ) throws LdapException
         {
             return null;
         }
 
-        public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
+        public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws LdapException
         {
             return null;
         }
 
-        public DN getSuffix( GetSuffixOperationContext opContext ) throws Exception
+        public DN getSuffix( GetSuffixOperationContext opContext ) throws LdapException
         {
             return null;
         }
 
-        public boolean hasEntry( EntryOperationContext opContext ) throws Exception
+        public boolean hasEntry( EntryOperationContext opContext ) throws LdapException
         {
             return false;
         }
 
-        public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
+        public EntryFilteringCursor list( ListOperationContext opContext ) throws LdapException
         {
             return null;
         }
 
-        public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
+        public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws LdapException
         {
             return null;
         }
 
-        public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
+        public ClonedServerEntry lookup( LookupOperationContext opContext ) throws LdapException
         {
             return null;
         }
 
-        public void modify( ModifyOperationContext opContext ) throws Exception
+        public void modify( ModifyOperationContext opContext ) throws LdapException
         {
         }
 
-        public void move( MoveOperationContext opContext ) throws Exception
+        public void move( MoveOperationContext opContext ) throws LdapException
         {
         }
 
-        public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
+        public void moveAndRename( MoveAndRenameOperationContext opContext ) throws LdapException
         {
         }
 
-        public void rename( RenameOperationContext opContext ) throws Exception
+        public void rename( RenameOperationContext opContext ) throws LdapException
         {
         }
 
-        public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
+        public EntryFilteringCursor search( SearchOperationContext opContext ) throws LdapException
         {
             return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
         }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Thu Jun  3 17:05:26 2010
@@ -616,7 +616,7 @@ public class InterceptorChainTest
         }
 
 
-        public CoreSession getAdminSession() throws Exception
+        public CoreSession getAdminSession()
         {
             return null;
         }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java Thu Jun  3 17:05:26 2010
@@ -22,8 +22,6 @@ package org.apache.directory.server.core
 
 import java.util.Set;
 
-import javax.naming.NamingException;
-
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
@@ -76,7 +74,7 @@ public class MockInterceptor implements 
 
 
     public void init( DirectoryService directoryService )
-        throws NamingException
+        throws LdapException
     {
     }
 
@@ -86,28 +84,28 @@ public class MockInterceptor implements 
     }
 
 
-    public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception
+    public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.getRootDSE( opContext );
     }
 
 
-    public DN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
+    public DN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.getMatchedName( opContext );
     }
 
 
-    public DN getSuffix ( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception
+    public DN getSuffix ( NextInterceptor next, GetSuffixOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.getSuffix( opContext );
     }
 
 
-    public Set<String> listSuffixes ( NextInterceptor next, ListSuffixOperationContext opContext ) throws Exception
+    public Set<String> listSuffixes ( NextInterceptor next, ListSuffixOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.listSuffixes( opContext );
@@ -115,28 +113,28 @@ public class MockInterceptor implements 
 
 
     public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext )
-        throws Exception
+        throws LdapException
     {
         test.interceptors.add( this );
         next.addContextPartition( opContext );
     }
 
 
-    public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception
+    public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         next.removeContextPartition( opContext );
     }
 
 
-    public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
+    public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.compare( opContext );
     }
 
 
-    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
+    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         next.delete( opContext );
@@ -144,42 +142,42 @@ public class MockInterceptor implements 
 
 
     public void add( NextInterceptor next, AddOperationContext opContext )
-        throws Exception
+        throws LdapException
     {
         test.interceptors.add( this );
         next.add( opContext );
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         next.modify( opContext );
     }
 
 
-    public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws Exception
+    public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.list( opContext );
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.search( opContext );
     }
 
 
-    public Entry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception
+    public Entry lookup( NextInterceptor next, LookupOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.lookup( opContext );
     }
 
 
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception
+    public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         return next.hasEntry( opContext );
@@ -187,14 +185,14 @@ public class MockInterceptor implements 
 
 
     public void rename( NextInterceptor next, RenameOperationContext opContext )
-        throws Exception
+        throws LdapException
     {
         test.interceptors.add( this );
         next.rename( opContext );
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
+    public void move( NextInterceptor next, MoveOperationContext opContext ) throws LdapException
     {
         test.interceptors.add( this );
         next.move( opContext );
@@ -202,7 +200,7 @@ public class MockInterceptor implements 
 
 
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
-        throws Exception
+        throws LdapException
     {
         test.interceptors.add( this );
         next.moveAndRename( opContext );

Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Thu Jun  3 17:05:26 2010
@@ -30,6 +30,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -59,15 +61,16 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.BinaryValue;
-import org.apache.directory.shared.ldap.entry.DefaultModification;
 import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
-import org.apache.directory.shared.ldap.entry.StringValue;
+import org.apache.directory.shared.ldap.entry.DefaultModification;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -123,7 +126,7 @@ public class KeyDerivationInterceptor ex
      * the special keyword 'randomKey', set random keys for the principal.  Set the key version number (kvno)
      * to '0'.
      */
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
         DN normName = addContext.getDn();
 
@@ -178,7 +181,7 @@ public class KeyDerivationInterceptor ex
      * 
      * If the 'userPassword' is the special keyword 'randomKey', set random keys for the principal.
      */
-    public void modify( NextInterceptor next, ModifyOperationContext modContext ) throws Exception
+    public void modify( NextInterceptor next, ModifyOperationContext modContext ) throws LdapException
     {
         ModifySubContext subContext = new ModifySubContext();
 
@@ -207,7 +210,7 @@ public class KeyDerivationInterceptor ex
      * @throws NamingException
      */
     void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext )
-        throws Exception
+        throws LdapException
     {
         List<Modification> mods = modContext.getModItems();
 
@@ -281,7 +284,7 @@ public class KeyDerivationInterceptor ex
      * @throws NamingException
      */
     void lookupPrincipalAttributes( ModifyOperationContext modContext, ModifySubContext subContext )
-        throws Exception
+        throws LdapException
     {
         DN principalDn = modContext.getDn();
 
@@ -346,7 +349,7 @@ public class KeyDerivationInterceptor ex
      * @param modContext
      * @param subContext
      */
-    void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext ) throws Exception
+    void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext ) throws LdapException
     {
         List<Modification> mods = modContext.getModItems();
 
@@ -393,7 +396,7 @@ public class KeyDerivationInterceptor ex
     }
 
 
-    private EntryAttribute getKeyAttribute( SchemaManager schemaManager, Map<EncryptionType, EncryptionKey> keys ) throws Exception
+    private EntryAttribute getKeyAttribute( SchemaManager schemaManager, Map<EncryptionType, EncryptionKey> keys ) throws LdapException
     {
         EntryAttribute keyAttribute = 
             new DefaultEntryAttribute( KerberosAttribute.KRB5_KEY_AT, 

Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java Thu Jun  3 17:05:26 2010
@@ -20,6 +20,9 @@
 package org.apache.directory.server.core.kerberos;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -27,19 +30,17 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.BinaryValue;
-import org.apache.directory.shared.ldap.entry.StringValue;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-
 
 /**
  * An {@link Interceptor} that enforces password policy for users.  Add or modify operations
@@ -65,7 +66,7 @@ public class PasswordPolicyInterceptor e
      * Check added attributes for a 'userPassword'.  If a 'userPassword' is found, apply any
      * password policy checks.
      */
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
         DN normName = addContext.getDn();
 
@@ -109,7 +110,7 @@ public class PasswordPolicyInterceptor e
      * Check modification items for a 'userPassword'.  If a 'userPassword' is found, apply any
      * password policy checks.
      */
-    public void modify( NextInterceptor next, ModifyOperationContext modContext ) throws Exception
+    public void modify( NextInterceptor next, ModifyOperationContext modContext ) throws LdapException
     {
         DN name = modContext.getDn();
 
@@ -184,7 +185,7 @@ public class PasswordPolicyInterceptor e
     }
 
 
-    void check( String username, String password ) throws Exception
+    void check( String username, String password ) throws LdapException
     {
         int passwordLength = 6;
         int categoryCount = 2;
@@ -195,7 +196,7 @@ public class PasswordPolicyInterceptor e
             String explanation = buildErrorMessage( username, password, passwordLength, categoryCount, tokenSize );
             log.error( explanation );
 
-            throw new Exception( explanation );
+            throw new LdapException( explanation );
         }
     }
 

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Thu Jun  3 17:05:26 2010
@@ -50,6 +50,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.exception.LdapOperationException;
 import org.apache.directory.shared.ldap.ldif.LdapLdifException;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
@@ -253,7 +254,7 @@ public class LdifPartition extends BTree
      * {@inheritDoc}
      */
     @Override
-    public void add( AddOperationContext addContext ) throws Exception
+    public void add( AddOperationContext addContext ) throws LdapException
     {
         wrappedPartition.add( addContext );
         add( addContext.getEntry() );
@@ -273,7 +274,7 @@ public class LdifPartition extends BTree
      * {@inheritDoc}
      */
     @Override
-    public void delete( Long id ) throws Exception
+    public void delete( Long id ) throws LdapException
     {
         Entry entry = lookup( id );
 
@@ -306,7 +307,7 @@ public class LdifPartition extends BTree
      * {@inheritDoc}
      */
     @Override
-    public void modify( ModifyOperationContext modifyContext ) throws Exception
+    public void modify( ModifyOperationContext modifyContext ) throws LdapException
     {
         Long id = getEntryId( modifyContext.getDn() );
 
@@ -320,9 +321,16 @@ public class LdifPartition extends BTree
         DN dn = modifyContext.getDn();
 
         // And write it back on disk
-        FileWriter fw = new FileWriter( getFile( dn, DELETE ) );
-        fw.write( LdifUtils.convertEntryToLdif( modifiedEntry, true ) );
-        fw.close();
+        try
+        {
+            FileWriter fw = new FileWriter( getFile( dn, DELETE ) );
+            fw.write( LdifUtils.convertEntryToLdif( modifiedEntry, true ) );
+            fw.close();
+        }
+        catch ( IOException ioe )
+        {
+            throw new LdapOperationException( ioe.getMessage() );
+        }
     }
 
 
@@ -330,7 +338,7 @@ public class LdifPartition extends BTree
      * {@inheritDoc}
      */
     @Override
-    public void move( MoveOperationContext moveContext ) throws Exception
+    public void move( MoveOperationContext moveContext ) throws LdapException
     {
         DN oldDn = moveContext.getDn();
         Long id = getEntryId( oldDn );
@@ -348,7 +356,7 @@ public class LdifPartition extends BTree
      * {@inheritDoc}
      */
     @Override
-    public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws Exception
+    public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
     {
         DN oldDn = moveAndRenameContext.getDn();
         Long id = getEntryId( oldDn );
@@ -367,7 +375,7 @@ public class LdifPartition extends BTree
      * {@inheritDoc}
      */
     @Override
-    public void rename( RenameOperationContext renameContext ) throws Exception
+    public void rename( RenameOperationContext renameContext ) throws LdapException
     {
         DN oldDn = renameContext.getDn();
         Long id = getEntryId( oldDn );
@@ -395,26 +403,34 @@ public class LdifPartition extends BTree
      * @param deleteOldEntry a flag to tell whether to delete the old entry files
      * @throws Exception
      */
-    private void entryMoved( DN oldEntryDn, Entry modifiedEntry, Long entryIdOld ) throws Exception
+    private void entryMoved( DN oldEntryDn, Entry modifiedEntry, Long entryIdOld ) throws LdapException
     {
         // First, add the new entry
         add( modifiedEntry );
 
         // Then, if there are some children, move then to the new place
-        IndexCursor<Long, Entry, Long> cursor = getSubLevelIndex().forwardCursor( entryIdOld );
-
-        while ( cursor.next() )
+        try
         {
-            IndexEntry<Long, Entry, Long> entry = cursor.get();
-
-            // except the parent entry add the rest of entries
-            if ( entry.getId() != entryIdOld )
-            {
-                add( wrappedPartition.lookup( entry.getId() ) );
+            IndexCursor<Long, Entry, Long> cursor = getSubLevelIndex().forwardCursor( entryIdOld );
+    
+            while ( cursor.next() )
+            {
+                IndexEntry<Long, Entry, Long> entry = cursor.get();
+    
+                // except the parent entry add the rest of entries
+                if ( entry.getId() != entryIdOld )
+                {
+                    add( wrappedPartition.lookup( entry.getId() ) );
+                }
             }
+
+            cursor.close();
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationException( e.getMessage() );
         }
 
-        cursor.close();
 
         // And delete the old entry's LDIF file
         File file = getFile( oldEntryDn, DELETE );
@@ -736,11 +752,18 @@ public class LdifPartition extends BTree
      * Write the new entry on disk. It does not exist, as this ha sbeen checked
      * by the ExceptionInterceptor.
      */
-    private void add( Entry entry ) throws Exception
+    private void add( Entry entry ) throws LdapException
     {
-        FileWriter fw = new FileWriter( getFile( entry.getDn(), CREATE ) );
-        fw.write( LdifUtils.convertEntryToLdif( entry ) );
-        fw.close();
+        try
+        {
+            FileWriter fw = new FileWriter( getFile( entry.getDn(), CREATE ) );
+            fw.write( LdifUtils.convertEntryToLdif( entry ) );
+            fw.close();
+        }
+        catch ( IOException ioe )
+        {
+            throw new LdapOperationException( ioe.getMessage() );
+        }
     }
 
 
@@ -800,7 +823,7 @@ public class LdifPartition extends BTree
 
 
     @Override
-    public int getChildCount( Long id ) throws Exception
+    public int getChildCount( Long id ) throws LdapException
     {
         return wrappedPartition.getChildCount( id );
     }
@@ -814,7 +837,7 @@ public class LdifPartition extends BTree
 
 
     @Override
-    public Long getEntryId( DN dn ) throws Exception
+    public Long getEntryId( DN dn ) throws LdapException
     {
         return wrappedPartition.getEntryId( dn );
     }
@@ -912,14 +935,14 @@ public class LdifPartition extends BTree
 
 
     @Override
-    public IndexCursor<Long, Entry, Long> list( Long id ) throws Exception
+    public IndexCursor<Long, Entry, Long> list( Long id ) throws LdapException
     {
         return wrappedPartition.list( id );
     }
 
 
     @Override
-    public ClonedServerEntry lookup( Long id ) throws Exception
+    public ClonedServerEntry lookup( Long id ) throws LdapException
     {
         return wrappedPartition.lookup( id );
     }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java Thu Jun  3 17:05:26 2010
@@ -49,6 +49,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -135,7 +136,7 @@ public class SearchLimitsIT extends Abst
         private Long delayMillis;
 
         
-        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
+        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws LdapException
         {
             EntryFilteringCursor cursor = next.search( opContext );
             cursor.addEntryFilter( new EntryFilter() {



Mime
View raw message