You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/06/03 19:05:29 UTC

svn commit: r951068 [6/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...

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Thu Jun  3 17:05:26 2010
@@ -49,8 +49,10 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.search.SearchEngine;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException;
+import org.apache.directory.shared.ldap.exception.LdapOperationErrorException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -232,7 +234,7 @@ public abstract class BTreePartition<ID>
     /**
      * {@inheritDoc}
      */
-    public void delete( DeleteOperationContext opContext ) throws Exception
+    public void delete( DeleteOperationContext opContext ) throws LdapException
     {
         DN dn = opContext.getDn();
 
@@ -255,32 +257,39 @@ public abstract class BTreePartition<ID>
     }
 
 
-    public abstract void add( AddOperationContext opContext ) throws Exception;
+    public abstract void add( AddOperationContext opContext ) throws LdapException;
 
 
-    public abstract void modify( ModifyOperationContext opContext ) throws Exception;
+    public abstract void modify( ModifyOperationContext opContext ) throws LdapException;
 
 
-    public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
+    public EntryFilteringCursor list( ListOperationContext opContext ) throws LdapException
     {
         return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor<ID>( this, list( getEntryId( opContext
             .getDn() ) ) ), opContext );
     }
 
 
-    public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
+    public EntryFilteringCursor search( SearchOperationContext opContext ) throws LdapException
     {
-        SearchControls searchCtls = opContext.getSearchControls();
-        IndexCursor<ID, Entry, ID> underlying;
-
-        underlying = searchEngine.cursor( opContext.getDn(), opContext.getAliasDerefMode(), opContext.getFilter(),
-            searchCtls );
-
-        return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor<ID>( this, underlying ), opContext );
+        try
+        {
+            SearchControls searchCtls = opContext.getSearchControls();
+            IndexCursor<ID, Entry, ID> underlying;
+    
+            underlying = searchEngine.cursor( opContext.getDn(), opContext.getAliasDerefMode(), opContext.getFilter(),
+                searchCtls );
+    
+            return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor<ID>( this, underlying ), opContext );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
-    public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
+    public ClonedServerEntry lookup( LookupOperationContext opContext ) throws LdapException
     {
         ID id = getEntryId( opContext.getDn() );
 
@@ -308,19 +317,19 @@ public abstract class BTreePartition<ID>
     }
 
 
-    public boolean hasEntry( EntryOperationContext opContext ) throws Exception
+    public boolean hasEntry( EntryOperationContext opContext ) throws LdapException
     {
         return null != getEntryId( opContext.getDn() );
     }
 
 
-    public abstract void rename( RenameOperationContext opContext ) throws Exception;
+    public abstract void rename( RenameOperationContext opContext ) throws LdapException;
 
 
-    public abstract void move( MoveOperationContext opContext ) throws Exception;
+    public abstract void move( MoveOperationContext opContext ) throws LdapException;
 
 
-    public abstract void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception;
+    public abstract void moveAndRename( MoveAndRenameOperationContext opContext ) throws LdapException;
 
 
     public abstract void sync() throws Exception;
@@ -425,22 +434,22 @@ public abstract class BTreePartition<ID>
     public abstract Index<? extends Object, Entry, ID> getSystemIndex( String attribute ) throws Exception;
 
 
-    public abstract ID getEntryId( DN dn ) throws Exception;
+    public abstract ID getEntryId( DN dn ) throws LdapException;
 
 
     public abstract DN getEntryDn( ID id ) throws Exception;
 
 
-    public abstract ClonedServerEntry lookup( ID id ) throws Exception;
+    public abstract ClonedServerEntry lookup( ID id ) throws LdapException;
 
 
-    public abstract void delete( ID id ) throws Exception;
+    public abstract void delete( ID id ) throws LdapException;
 
 
-    public abstract IndexCursor<ID, Entry, ID> list( ID id ) throws Exception;
+    public abstract IndexCursor<ID, Entry, ID> list( ID id ) throws LdapException;
 
 
-    public abstract int getChildCount( ID id ) throws Exception;
+    public abstract int getChildCount( ID id ) throws LdapException;
 
 
     public abstract void setProperty( String key, String value ) throws Exception;

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/AbstractXdbmPartition.java Thu Jun  3 17:05:26 2010
@@ -36,6 +36,7 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapOperationErrorException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
@@ -194,9 +195,16 @@ public abstract class AbstractXdbmPartit
     }
 
 
-    public final ID getEntryId( DN dn ) throws Exception
+    public final ID getEntryId( DN dn ) throws LdapException
     {
-        return store.getEntryId( dn );
+        try
+        {
+            return store.getEntryId( dn );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapException( e.getMessage() );
+        }
     }
 
 
@@ -212,33 +220,68 @@ public abstract class AbstractXdbmPartit
     }
 
 
-    public final void add( AddOperationContext addContext ) throws Exception
+    public final void add( AddOperationContext addContext ) throws LdapException
     {
-        store.add( ( Entry ) ( ( ClonedServerEntry ) addContext.getEntry() ).getClonedEntry() );
+        try
+        {
+            store.add( ( Entry ) ( ( ClonedServerEntry ) addContext.getEntry() ).getClonedEntry() );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapException( e );
+        }
     }
 
 
-    public final ClonedServerEntry lookup( ID id ) throws Exception
+    public final ClonedServerEntry lookup( ID id ) throws LdapException
     {
-        return new ClonedServerEntry( store.lookup( id ) );
+        try
+        {
+            return new ClonedServerEntry( store.lookup( id ) );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
-    public final void delete( ID id ) throws Exception
+    public final void delete( ID id ) throws LdapException
     {
-        store.delete( id );
+        try
+        {
+            store.delete( id );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
-    public final IndexCursor<ID, Entry, ID> list( ID id ) throws Exception
+    public final IndexCursor<ID, Entry, ID> list( ID id ) throws LdapException
     {
-        return store.list( id );
+        try
+        {
+            return store.list( id );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
-    public final int getChildCount( ID id ) throws Exception
+    public final int getChildCount( ID id ) throws LdapException
     {
-        return store.getChildCount( id );
+        try
+        {
+            return store.getChildCount( id );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
@@ -254,31 +297,61 @@ public abstract class AbstractXdbmPartit
     }
 
 
-    public final void modify( ModifyOperationContext modifyContext ) throws Exception
+    public final void modify( ModifyOperationContext modifyContext ) throws LdapException
     {
-        Entry modifiedEntry = store.modify( modifyContext.getDn(), modifyContext.getModItems() );
-        modifyContext.setAlteredEntry( modifiedEntry );
+        try
+        {
+            Entry modifiedEntry = store.modify( modifyContext.getDn(), modifyContext.getModItems() );
+            modifyContext.setAlteredEntry( modifiedEntry );
+        }
+        catch ( Exception e )
+        {
+            
+        }
     }
 
 
-    public final void rename( RenameOperationContext renameContext ) throws Exception
+    public final void rename( RenameOperationContext renameContext ) throws LdapException
     {
-        store.rename( renameContext.getDn(), renameContext.getNewRdn(), renameContext.getDelOldDn() );
+        try
+        {
+            store.rename( renameContext.getDn(), renameContext.getNewRdn(), renameContext.getDelOldDn() );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
-    public final void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws Exception
+    public final void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
     {
         checkIsValidMove( moveAndRenameContext.getDn(), moveAndRenameContext.getParent() );
-        store.move( moveAndRenameContext.getDn(), moveAndRenameContext.getParent(), moveAndRenameContext.getNewRdn(),
-            moveAndRenameContext.getDelOldDn() );
+
+        try
+        {
+            store.move( moveAndRenameContext.getDn(), moveAndRenameContext.getParent(), moveAndRenameContext.getNewRdn(),
+                moveAndRenameContext.getDelOldDn() );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
-    public final void move( MoveOperationContext moveContext ) throws Exception
+    public final void move( MoveOperationContext moveContext ) throws LdapException
     {
         checkIsValidMove( moveContext.getDn(), moveContext.getParent() );
-        store.move( moveContext.getDn(), moveContext.getParent() );
+
+        try
+        {
+            store.move( moveContext.getDn(), moveContext.getParent() );
+        }
+        catch ( Exception e )
+        {
+            throw new LdapOperationErrorException( e.getMessage() );
+        }
     }
 
 
@@ -290,7 +363,7 @@ public abstract class AbstractXdbmPartit
      * @param newParentDn new parent entry's DN
      * @throws Exception
      */
-    private void checkIsValidMove( DN oldChildDn, DN newParentDn ) throws Exception
+    private void checkIsValidMove( DN oldChildDn, DN newParentDn ) throws LdapException
     {
         boolean invalid = false;
 

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java (original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java Thu Jun  3 17:05:26 2010
@@ -20,12 +20,12 @@
 package org.apache.directory.shared.ldap.schema.loader.ldif;
 
 
-import javax.naming.NamingException;
-import javax.naming.directory.InvalidAttributeValueException;
-
 import org.apache.directory.shared.i18n.I18n;
 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.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 
 
 /**
@@ -45,11 +45,11 @@ public class AttributeClassLoader extend
     }
     
     
-    public void setAttribute( EntryAttribute attribute ) throws NamingException
+    public void setAttribute( EntryAttribute attribute ) throws LdapException
     {
         if ( attribute.isHR() )
         {
-            throw new InvalidAttributeValueException( I18n.err( I18n.ERR_10001 ) );
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.CONSTRAINT_VIOLATION, I18n.err( I18n.ERR_10001 ) );
         }
         
         this.attribute = attribute;

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java (original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java Thu Jun  3 17:05:26 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.ldap
 
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
@@ -31,6 +32,7 @@ import java.util.regex.Pattern;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
@@ -80,7 +82,7 @@ public class JarLdifSchemaLoader extends
     }
 
 
-    private final URL getResource( String resource, String msg ) throws Exception
+    private final URL getResource( String resource, String msg ) throws IOException
     {
         if ( RESOURCE_MAP.get( resource ) )
         {
@@ -157,7 +159,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadComparators( Schema... schemas ) throws Exception
+    public List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> comparatorList = new ArrayList<Entry>();
 
@@ -193,7 +195,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws Exception
+    public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> syntaxCheckerList = new ArrayList<Entry>();
 
@@ -229,7 +231,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadNormalizers( Schema... schemas ) throws Exception
+    public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> normalizerList = new ArrayList<Entry>();
 
@@ -265,7 +267,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadMatchingRules( Schema... schemas ) throws Exception
+    public List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> matchingRuleList = new ArrayList<Entry>();
 
@@ -301,7 +303,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadSyntaxes( Schema... schemas ) throws Exception
+    public List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> syntaxList = new ArrayList<Entry>();
 
@@ -337,7 +339,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadAttributeTypes( Schema... schemas ) throws Exception
+    public List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> attributeTypeList = new ArrayList<Entry>();
 
@@ -375,7 +377,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws Exception
+    public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> matchingRuleUseList = new ArrayList<Entry>();
 
@@ -412,7 +414,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadNameForms( Schema... schemas ) throws Exception
+    public List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> nameFormList = new ArrayList<Entry>();
 
@@ -448,7 +450,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadDitContentRules( Schema... schemas ) throws Exception
+    public List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> ditContentRulesList = new ArrayList<Entry>();
 
@@ -485,7 +487,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadDitStructureRules( Schema... schemas ) throws Exception
+    public List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> ditStructureRuleList = new ArrayList<Entry>();
 
@@ -522,7 +524,7 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadObjectClasses( Schema... schemas ) throws Exception
+    public List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> objectClassList = new ArrayList<Entry>();
 

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java (original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java Thu Jun  3 17:05:26 2010
@@ -23,12 +23,14 @@ package org.apache.directory.shared.ldap
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FilenameFilter;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.schema.registries.AbstractSchemaLoader;
@@ -248,7 +250,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadComparators( Schema... schemas ) throws Exception
+    public List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> comparatorList = new ArrayList<Entry>();
 
@@ -285,7 +287,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws Exception
+    public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> syntaxCheckerList = new ArrayList<Entry>();
 
@@ -322,7 +324,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadNormalizers( Schema... schemas ) throws Exception
+    public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> normalizerList = new ArrayList<Entry>();
 
@@ -359,7 +361,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadMatchingRules( Schema... schemas ) throws Exception
+    public List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> matchingRuleList = new ArrayList<Entry>();
 
@@ -396,7 +398,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadSyntaxes( Schema... schemas ) throws Exception
+    public List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> syntaxList = new ArrayList<Entry>();
 
@@ -433,7 +435,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadAttributeTypes( Schema... schemas ) throws Exception
+    public List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> attributeTypeList = new ArrayList<Entry>();
 
@@ -472,7 +474,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws Exception
+    public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> matchingRuleUseList = new ArrayList<Entry>();
 
@@ -510,7 +512,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadNameForms( Schema... schemas ) throws Exception
+    public List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> nameFormList = new ArrayList<Entry>();
 
@@ -547,7 +549,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadDitContentRules( Schema... schemas ) throws Exception
+    public List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> ditContentRuleList = new ArrayList<Entry>();
 
@@ -585,7 +587,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadDitStructureRules( Schema... schemas ) throws Exception
+    public List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> ditStructureRuleList = new ArrayList<Entry>();
 
@@ -623,7 +625,7 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
-    public List<Entry> loadObjectClasses( Schema... schemas ) throws Exception
+    public List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException
     {
         List<Entry> objectClassList = new ArrayList<Entry>();
 

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java (original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java Thu Jun  3 17:05:26 2010
@@ -34,6 +34,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.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -197,7 +198,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
-    public Schema getSchema( Entry entry ) throws Exception
+    public Schema getSchema( Entry entry ) throws LdapException
     {
         String name;
         String owner;
@@ -206,19 +207,19 @@ public class SchemaEntityFactory impleme
 
         if ( entry == null )
         {
-            throw new NullPointerException( I18n.err( I18n.ERR_10010 ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_10010 ) );
         }
 
         if ( entry.get( SchemaConstants.CN_AT ) == null )
         {
-            throw new NullPointerException( I18n.err( I18n.ERR_10011 ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_10011 ) );
         }
 
         name = entry.get( SchemaConstants.CN_AT ).getString();
 
         if ( entry.get( SchemaConstants.CREATORS_NAME_AT ) == null )
         {
-            throw new NullPointerException( I18n.err( I18n.ERR_10012, SchemaConstants.CREATORS_NAME_AT ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_10012, SchemaConstants.CREATORS_NAME_AT ) );
         }
 
         owner = entry.get( SchemaConstants.CREATORS_NAME_AT ).getString();
@@ -287,7 +288,7 @@ public class SchemaEntityFactory impleme
      * {@inheritDoc}
      */
     public SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
-        String schemaName ) throws Exception
+        String schemaName ) throws LdapException
     {
         checkEntry( entry, SchemaConstants.SYNTAX_CHECKER );
 
@@ -319,14 +320,21 @@ public class SchemaEntityFactory impleme
         // The ByteCode
         EntryAttribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT );
 
-        // Class load the syntaxChecker
-        SyntaxChecker syntaxChecker = classLoadSyntaxChecker( oid, className, byteCode );
-
-        // Update the common fields
-        setSchemaObjectProperties( syntaxChecker, entry, schema );
-
-        // return the resulting syntaxChecker
-        return syntaxChecker;
+        try
+        {
+            // Class load the syntaxChecker
+            SyntaxChecker syntaxChecker = classLoadSyntaxChecker( oid, className, byteCode );
+    
+            // Update the common fields
+            setSchemaObjectProperties( syntaxChecker, entry, schema );
+    
+            // return the resulting syntaxChecker
+            return syntaxChecker;
+        }
+        catch ( Exception e )
+        {
+            throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getMessage() );
+        }
     }
 
 
@@ -469,7 +477,7 @@ public class SchemaEntityFactory impleme
      * {@inheritDoc}
      */
     public LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
-        String schemaName ) throws Exception
+        String schemaName ) throws LdapException
     {
         checkEntry( entry, SchemaConstants.COMPARATOR );
 
@@ -501,14 +509,21 @@ public class SchemaEntityFactory impleme
         // The ByteCode
         EntryAttribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT );
 
-        // Class load the comparator
-        LdapComparator<?> comparator = classLoadComparator( schemaManager, oid, fqcn, byteCode );
-
-        // Update the common fields
-        setSchemaObjectProperties( comparator, entry, schema );
+        try
+        {
+            // Class load the comparator
+            LdapComparator<?> comparator = classLoadComparator( schemaManager, oid, fqcn, byteCode );
+    
+            // Update the common fields
+            setSchemaObjectProperties( comparator, entry, schema );
 
-        // return the resulting comparator
-        return comparator;
+            // return the resulting comparator
+            return comparator;
+        }
+        catch ( Exception e )
+        {
+            throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getMessage() );
+        }
     }
 
 
@@ -593,7 +608,7 @@ public class SchemaEntityFactory impleme
      * {@inheritDoc}
      */
     public Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
-        String schemaName ) throws Exception
+        String schemaName ) throws LdapException
     {
         checkEntry( entry, SchemaConstants.NORMALIZER );
 
@@ -625,14 +640,21 @@ public class SchemaEntityFactory impleme
         // The ByteCode
         EntryAttribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT );
 
-        // Class load the Normalizer
-        Normalizer normalizer = classLoadNormalizer( schemaManager, oid, className, byteCode );
-
-        // Update the common fields
-        setSchemaObjectProperties( normalizer, entry, schema );
-
-        // return the resulting Normalizer
-        return normalizer;
+        try
+        {
+            // Class load the Normalizer
+            Normalizer normalizer = classLoadNormalizer( schemaManager, oid, className, byteCode );
+    
+            // Update the common fields
+            setSchemaObjectProperties( normalizer, entry, schema );
+    
+            // return the resulting Normalizer
+            return normalizer;
+        }
+        catch ( Exception e )
+        {
+            throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getMessage() );
+        }
     }
 
 
@@ -764,7 +786,7 @@ public class SchemaEntityFactory impleme
      * {@inheritDoc}
      */
     public ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
-        String schemaName ) throws Exception
+        String schemaName ) throws LdapException
     {
         checkEntry( entry, SchemaConstants.OBJECT_CLASS );
 

Modified: directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java (original)
+++ directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java Thu Jun  3 17:05:26 2010
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.ldap.schema.manager.impl;
 
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -34,6 +35,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.LdapOtherException;
 import org.apache.directory.shared.ldap.exception.LdapProtocolErrorException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -166,29 +168,36 @@ public class DefaultSchemaManager implem
      * Clone the registries before doing any modification on it. Relax it
      * too so that we can update it. 
      */
-    private Registries cloneRegistries() throws Exception
+    private Registries cloneRegistries() throws LdapException
     {
-        // Relax the controls at first
-        errors = new ArrayList<Throwable>();
-
-        // Clone the Registries
-        Registries clonedRegistries = registries.clone();
-
-        // And update references. We may have errors, that may be fixed
-        // by the new loaded schemas.
-        errors = clonedRegistries.checkRefInteg();
-
-        // Now, relax the cloned Registries if there is no error
-        clonedRegistries.setRelaxed();
-
-        return clonedRegistries;
+        try
+        {
+            // Relax the controls at first
+            errors = new ArrayList<Throwable>();
+    
+            // Clone the Registries
+            Registries clonedRegistries = registries.clone();
+    
+            // And update references. We may have errors, that may be fixed
+            // by the new loaded schemas.
+            errors = clonedRegistries.checkRefInteg();
+    
+            // Now, relax the cloned Registries if there is no error
+            clonedRegistries.setRelaxed();
+    
+            return clonedRegistries;
+        }
+        catch ( CloneNotSupportedException cnse )
+        {
+            throw new LdapOtherException( cnse.getMessage() );
+        }
     }
 
 
     /**
      * Transform a String[] array of schema to a Schema[]
      */
-    private Schema[] toArray( String... schemas ) throws Exception
+    private Schema[] toArray( String... schemas ) throws LdapException
     {
         Schema[] schemaArray = new Schema[schemas.length];
         int n = 0;
@@ -212,23 +221,30 @@ public class DefaultSchemaManager implem
     }
 
 
-    private void addSchemaObjects( Schema schema, Registries registries ) throws Exception
+    private void addSchemaObjects( Schema schema, Registries registries ) throws LdapException
     {
         // Create a content container for this schema
         registries.addSchema( schema.getSchemaName() );
 
-        // And inject any existig SchemaObject into the registries 
-        addComparators( schema, registries );
-        addNormalizers( schema, registries );
-        addSyntaxCheckers( schema, registries );
-        addSyntaxes( schema, registries );
-        addMatchingRules( schema, registries );
-        addAttributeTypes( schema, registries );
-        addObjectClasses( schema, registries );
-        addMatchingRuleUses( schema, registries );
-        addDitContentRules( schema, registries );
-        addNameForms( schema, registries );
-        addDitStructureRules( schema, registries );
+        // And inject any existing SchemaObject into the registries 
+        try
+        {
+            addComparators( schema, registries );
+            addNormalizers( schema, registries );
+            addSyntaxCheckers( schema, registries );
+            addSyntaxes( schema, registries );
+            addMatchingRules( schema, registries );
+            addAttributeTypes( schema, registries );
+            addObjectClasses( schema, registries );
+            addMatchingRuleUses( schema, registries );
+            addDitContentRules( schema, registries );
+            addNameForms( schema, registries );
+            addDitStructureRules( schema, registries );
+        }
+        catch ( IOException ioe )
+        {
+            throw new LdapOtherException( ioe.getMessage() );
+        }
 
         // TODO Add some listener handling at this point
         //notifyListenerOrRegistries( schema, registries );
@@ -238,7 +254,7 @@ public class DefaultSchemaManager implem
     /**
      * Delete all the schemaObjects for a given schema from the registries
      */
-    private void deleteSchemaObjects( Schema schema, Registries registries ) throws Exception
+    private void deleteSchemaObjects( Schema schema, Registries registries ) throws LdapException
     {
         Map<String, Set<SchemaObjectWrapper>> schemaObjects = registries.getObjectBySchemaName();
         Set<SchemaObjectWrapper> content = schemaObjects.get( StringTools.toLowerCase( schema.getSchemaName() ) );
@@ -264,7 +280,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean disable( Schema... schemas ) throws Exception
+    public boolean disable( Schema... schemas ) throws LdapException
     {
         boolean disabled = false;
 
@@ -321,7 +337,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean disable( String... schemaNames ) throws Exception
+    public boolean disable( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
 
@@ -371,7 +387,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean enable( Schema... schemas ) throws Exception
+    public boolean enable( Schema... schemas ) throws LdapException
     {
         boolean enabled = false;
 
@@ -429,7 +445,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean enable( String... schemaNames ) throws Exception
+    public boolean enable( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
         return enable( schemas );
@@ -506,7 +522,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean load( Schema... schemas ) throws Exception
+    public boolean load( Schema... schemas ) throws LdapException
     {
         if ( schemas.length == 0 )
         {
@@ -611,7 +627,7 @@ public class DefaultSchemaManager implem
      * - isRelaxed
      * - disabledAccepted
      */
-    private boolean load( Registries registries, Schema schema ) throws Exception
+    private boolean load( Registries registries, Schema schema ) throws LdapException
     {
         if ( schema == null )
         {
@@ -675,7 +691,7 @@ public class DefaultSchemaManager implem
      */
     // False positive
     @SuppressWarnings("PMD.UnusedPrivateMethod")
-    private boolean unload( Registries registries, Schema schema ) throws Exception
+    private boolean unload( Registries registries, Schema schema ) throws LdapException
     {
         if ( schema == null )
         {
@@ -704,7 +720,7 @@ public class DefaultSchemaManager implem
     /**
      * Add all the Schema's AttributeTypes
      */
-    private void addAttributeTypes( Schema schema, Registries registries ) throws Exception
+    private void addAttributeTypes( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadAttributeTypes( schema ) )
         {
@@ -718,7 +734,7 @@ public class DefaultSchemaManager implem
     /**
      * Add all the Schema's comparators
      */
-    private void addComparators( Schema schema, Registries registries ) throws Exception
+    private void addComparators( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadComparators( schema ) )
         {
@@ -734,16 +750,12 @@ public class DefaultSchemaManager implem
      */
     // Not yet implemented, but may be used
     @SuppressWarnings("PMD.UnusedFormalParameter")
-    private void addDitContentRules( Schema schema, Registries registries ) throws Exception
+    private void addDitContentRules( Schema schema, Registries registries ) throws LdapException, IOException
     {
         if ( !schemaLoader.loadDitContentRules( schema ).isEmpty() )
         {
             throw new NotImplementedException( I18n.err( I18n.ERR_11003 ) );
         }
-        // for ( Entry entry : schemaLoader.loadDitContentRules( schema ) )
-        // {
-        //     throw new NotImplementedException( I18n.err( I18n.ERR_11003 ) );
-        // }
     }
 
 
@@ -752,23 +764,19 @@ public class DefaultSchemaManager implem
      */
     // Not yet implemented, but may be used
     @SuppressWarnings("PMD.UnusedFormalParameter")
-    private void addDitStructureRules( Schema schema, Registries registries ) throws Exception
+    private void addDitStructureRules( Schema schema, Registries registries ) throws LdapException, IOException
     {
         if ( !schemaLoader.loadDitStructureRules( schema ).isEmpty() )
         {
             throw new NotImplementedException( I18n.err( I18n.ERR_11004 ) );
         }
-        // for ( Entry entry : schemaLoader.loadDitStructureRules( schema ) )
-        // {
-        //     throw new NotImplementedException( I18n.err( I18n.ERR_11004 ) );
-        // }
     }
 
 
     /**
      * Add all the Schema's MatchingRules
      */
-    private void addMatchingRules( Schema schema, Registries registries ) throws Exception
+    private void addMatchingRules( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadMatchingRules( schema ) )
         {
@@ -784,7 +792,7 @@ public class DefaultSchemaManager implem
      */
     // Not yet implemented, but may be used
     @SuppressWarnings("PMD.UnusedFormalParameter")
-    private void addMatchingRuleUses( Schema schema, Registries registries ) throws Exception
+    private void addMatchingRuleUses( Schema schema, Registries registries ) throws LdapException, IOException
     {
         if ( !schemaLoader.loadMatchingRuleUses( schema ).isEmpty() )
         {
@@ -802,23 +810,19 @@ public class DefaultSchemaManager implem
      */
     // Not yet implemented, but may be used
     @SuppressWarnings("PMD.UnusedFormalParameter")
-    private void addNameForms( Schema schema, Registries registries ) throws Exception
+    private void addNameForms( Schema schema, Registries registries ) throws LdapException, IOException
     {
         if ( !schemaLoader.loadNameForms( schema ).isEmpty() )
         {
             throw new NotImplementedException( I18n.err( I18n.ERR_11006 ) );
         }
-        // for ( Entry entry : schemaLoader.loadNameForms( schema ) )
-        // {
-        //     throw new NotImplementedException( I18n.err( I18n.ERR_11006 ) );
-        // }
     }
 
 
     /**
      * Add all the Schema's Normalizers
      */
-    private void addNormalizers( Schema schema, Registries registries ) throws Exception
+    private void addNormalizers( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadNormalizers( schema ) )
         {
@@ -832,7 +836,7 @@ public class DefaultSchemaManager implem
     /**
      * Add all the Schema's ObjectClasses
      */
-    private void addObjectClasses( Schema schema, Registries registries ) throws Exception
+    private void addObjectClasses( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadObjectClasses( schema ) )
         {
@@ -846,7 +850,7 @@ public class DefaultSchemaManager implem
     /**
      * Add all the Schema's Syntaxes
      */
-    private void addSyntaxes( Schema schema, Registries registries ) throws Exception
+    private void addSyntaxes( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadSyntaxes( schema ) )
         {
@@ -860,7 +864,7 @@ public class DefaultSchemaManager implem
     /**Add
      * Register all the Schema's SyntaxCheckers
      */
-    private void addSyntaxCheckers( Schema schema, Registries registries ) throws Exception
+    private void addSyntaxCheckers( Schema schema, Registries registries ) throws LdapException, IOException
     {
         for ( Entry entry : schemaLoader.loadSyntaxCheckers( schema ) )
         {
@@ -881,7 +885,7 @@ public class DefaultSchemaManager implem
      * @throws Exception If the registering failed
      */
     private SchemaObject addSchemaObject( Registries registries, SchemaObject schemaObject, Schema schema )
-        throws Exception
+        throws LdapException
     {
         if ( registries.isRelaxed() )
         {
@@ -934,7 +938,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean loadDisabled( Schema... schemas ) throws Exception
+    public boolean loadDisabled( Schema... schemas ) throws LdapException
     {
         // Work on a cloned and relaxed registries
         Registries clonedRegistries = cloneRegistries();
@@ -978,7 +982,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean loadDisabled( String... schemaNames ) throws Exception
+    public boolean loadDisabled( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
 
@@ -1172,7 +1176,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean unload( Schema... schemas ) throws Exception
+    public boolean unload( Schema... schemas ) throws LdapException
     {
         boolean unloaded = false;
 
@@ -1242,7 +1246,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean unload( String... schemaNames ) throws Exception
+    public boolean unload( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
 
@@ -1621,7 +1625,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean add( SchemaObject schemaObject ) throws Exception
+    public boolean add( SchemaObject schemaObject ) throws LdapException
     {
         // First, clear the errors
         errors.clear();
@@ -1684,7 +1688,16 @@ public class DefaultSchemaManager implem
             if ( schema.isEnabled() && copy.isEnabled() )
             {
                 // As we may break the registries, work on a cloned registries
-                Registries clonedRegistries = registries.clone();
+                Registries clonedRegistries = null;
+                
+                try
+                {
+                    clonedRegistries = registries.clone();
+                }
+                catch ( CloneNotSupportedException cnse )
+                {
+                    throw new LdapOtherException( cnse.getMessage() );
+                }
 
                 // Inject the new SchemaObject in the cloned registries
                 clonedRegistries.add( errors, copy );
@@ -1731,7 +1744,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
-    public boolean delete( SchemaObject schemaObject ) throws Exception
+    public boolean delete( SchemaObject schemaObject ) throws LdapException
     {
         // First, clear the errors
         errors.clear();
@@ -1788,7 +1801,16 @@ public class DefaultSchemaManager implem
             if ( schema.isEnabled() && schemaObject.isEnabled() )
             {
                 // As we may break the registries, work on a cloned registries
-                Registries clonedRegistries = registries.clone();
+                Registries clonedRegistries = null;
+                
+                try
+                {
+                    clonedRegistries = registries.clone();
+                }
+                catch ( CloneNotSupportedException cnse )
+                {
+                    throw new LdapOtherException( cnse.getMessage() );
+                }
 
                 // Delete the SchemaObject from the cloned registries
                 clonedRegistries.delete( errors, toDelete );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/EntityFactory.java Thu Jun  3 17:05:26 2010
@@ -78,7 +78,7 @@ public interface EntityFactory
      * @throws LdapException if anything fails during loading
      */
     LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, 
-        Registries targetRegistries, String schemaName ) throws Exception;
+        Registries targetRegistries, String schemaName ) throws LdapException;
     
 
     /**
@@ -119,7 +119,7 @@ public interface EntityFactory
      * @throws LdapException if anything fails during loading
      */
     Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 
-        throws Exception;
+        throws LdapException;
     
     
     /**
@@ -131,7 +131,7 @@ public interface EntityFactory
      * @return
      * @throws Exception
      */
-    ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws Exception;
+    ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException;
     
     
     /**
@@ -156,7 +156,7 @@ public interface EntityFactory
      * @return the loaded SyntaxChecker
      * @throws LdapException if anything fails during loading
      */
-    SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws Exception;
+    SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException;
     
 
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaManager.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaManager.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaManager.java Thu Jun  3 17:05:26 2010
@@ -69,7 +69,7 @@ public interface SchemaManager
      * @return true if the schemas have been loaded and the registries is consistent
      * @throws Exception @TODO 
      */
-    boolean load( Schema... schemas ) throws Exception;
+    boolean load( Schema... schemas ) throws LdapException;
 
 
     /**
@@ -211,7 +211,7 @@ public interface SchemaManager
      * @return true if the schemas have been loaded
      * @throws Exception @TODO 
      */
-    boolean loadDisabled( String... schemas ) throws Exception;
+    boolean loadDisabled( String... schemas ) throws LdapException;
 
 
     /**
@@ -249,7 +249,7 @@ public interface SchemaManager
      * @param schemas The list of Schema to unload
      * @return True if all the schemas have been unloaded
      */
-    boolean unload( String... schemas ) throws Exception;
+    boolean unload( String... schemas ) throws LdapException;
 
 
     //---------------------------------------------------------------------------------
@@ -280,7 +280,7 @@ public interface SchemaManager
      *  @return true if the Registries is still consistent, false otherwise.
      *  @throws If something went wrong
      */
-    boolean enable( String... schemas ) throws Exception;
+    boolean enable( String... schemas ) throws LdapException;
 
 
     /**
@@ -354,7 +354,7 @@ public interface SchemaManager
      *  @return true if the Registries is still consistent, false otherwise.
      *  @throws If something went wrong
      */
-    boolean disable( String... schemas ) throws Exception;
+    boolean disable( String... schemas ) throws LdapException;
 
 
     /**
@@ -649,10 +649,10 @@ public interface SchemaManager
      *
      * @param schemaObject the SchemaObject to register
      * @return true if the addition has been made, false if there were some errors
-     * @throws Exception if the SchemaObject is already registered or
+     * @throws LdapException if the SchemaObject is already registered or
      * the registration operation is not supported
      */
-    boolean add( SchemaObject schemaObject ) throws Exception;
+    boolean add( SchemaObject schemaObject ) throws LdapException;
 
 
     /**
@@ -666,7 +666,7 @@ public interface SchemaManager
      * @throws Exception if the SchemaObject is not registered or
      * the deletion operation is not supported
      */
-    boolean delete( SchemaObject schemaObject ) throws Exception;
+    boolean delete( SchemaObject schemaObject ) throws LdapException;
 
 
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java?rev=951068&r1=951067&r2=951068&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java Thu Jun  3 17:05:26 2010
@@ -20,10 +20,12 @@
 package org.apache.directory.shared.ldap.schema.registries;
 
 
+import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
 
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.exception.LdapException;
 
 
 /**
@@ -93,7 +95,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which AttributeTypes are loaded
      * @throws Exception if there are failures accessing AttributeType information
      */
-    List<Entry> loadAttributeTypes( Schema... schemas ) throws Exception;
+    List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -113,7 +115,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which Comparators are loaded
      * @throws Exception if there are failures accessing Comparator information
      */
-    List<Entry> loadComparators( Schema... schemas ) throws Exception;
+    List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -133,7 +135,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which DitContentRules are loaded
      * @throws Exception if there are failures accessing DitContentRule information
      */
-    List<Entry> loadDitContentRules( Schema... schemas ) throws Exception;
+    List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -153,7 +155,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which DitStructureRules are loaded
      * @throws Exception if there are failures accessing DitStructureRule information
      */
-    List<Entry> loadDitStructureRules( Schema... schemas ) throws Exception;
+    List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -173,7 +175,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which MatchingRules are loaded
      * @throws Exception if there are failures accessing MatchingRule information
      */
-    List<Entry> loadMatchingRules( Schema... schemas ) throws Exception;
+    List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -193,7 +195,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which MatchingRuleUses are loaded
      * @throws Exception if there are failures accessing MatchingRuleUse information
      */
-    List<Entry> loadMatchingRuleUses( Schema... schemas ) throws Exception;
+    List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -213,7 +215,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which NameForms are loaded
      * @throws Exception if there are failures accessing NameForm information
      */
-    List<Entry> loadNameForms( Schema... schemas ) throws Exception;
+    List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -233,7 +235,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which Normalizers are loaded
      * @throws Exception if there are failures accessing Normalizer information
      */
-    List<Entry> loadNormalizers( Schema... schemas ) throws Exception;
+    List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -253,7 +255,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which ObjectClasses are loaded
      * @throws Exception if there are failures accessing ObjectClass information
      */
-    List<Entry> loadObjectClasses( Schema... schemas ) throws Exception;
+    List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -273,7 +275,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which Syntaxes are loaded
      * @throws Exception if there are failures accessing Syntax information
      */
-    List<Entry> loadSyntaxes( Schema... schemas ) throws Exception;
+    List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException;
 
 
     /**
@@ -293,7 +295,7 @@ public interface SchemaLoader
      * @param schemas the schemas from which SyntaxCheckers are loaded
      * @throws Exception if there are failures accessing SyntaxChecker information
      */
-    List<Entry> loadSyntaxCheckers( Schema... schemas ) throws Exception;
+    List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException;
 
 
     /**