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 2016/02/23 18:20:47 UTC
svn commit: r1731906 - in /directory/shared/trunk:
integ-osgi/src/test/java/org/apache/directory/api/osgi/
ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/
ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registri...
Author: elecharny
Date: Tue Feb 23 17:20:46 2016
New Revision: 1731906
URL: http://svn.apache.org/viewvc?rev=1731906&view=rev
Log:
o Made the SchemaManager and the SchemaLoader classes throw an LdapException instead of an Exception
o Same thing for the EntityFactor classes
Added:
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/PrepareStringTest.java
Modified:
directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapSchemaDataOsgiTest.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaManager.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/SchemaLoader.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/EntityFactory.java
directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java
directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java
directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java
directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java
directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
Modified: directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapSchemaDataOsgiTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapSchemaDataOsgiTest.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapSchemaDataOsgiTest.java (original)
+++ directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapSchemaDataOsgiTest.java Tue Feb 23 17:20:46 2016
@@ -20,6 +20,9 @@
package org.apache.directory.api.osgi;
+import java.io.IOException;
+
+import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
@@ -36,7 +39,7 @@ public class ApiLdapSchemaDataOsgiTest e
@Override
- protected void useBundleClasses() throws Exception
+ protected void useBundleClasses() throws LdapException, IOException
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
loader.getAllEnabled();
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaManager.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaManager.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaManager.java Tue Feb 23 17:20:46 2016
@@ -72,7 +72,7 @@ public interface SchemaManager
*
* @param schemas the Schemas to load
* @return true if the schemas have been loaded and the registries is consistent
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
boolean load( Schema... schemas ) throws LdapException;
@@ -88,9 +88,9 @@ public interface SchemaManager
*
* @param schemas the Schemas' name to load
* @return true if the schemas have been loaded and the registries is consistent
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean load( String... schemas ) throws Exception;
+ boolean load( String... schemas ) throws LdapException;
/**
@@ -104,9 +104,9 @@ public interface SchemaManager
*
* @param schemas the Schemas to load
* @return true if the schemas have been loaded and the registries is consistent
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadWithDeps( Schema... schemas ) throws Exception;
+ boolean loadWithDeps( Schema... schemas ) throws LdapException;
/**
@@ -120,9 +120,9 @@ public interface SchemaManager
*
* @param schemas the Schemas' name to load
* @return true if the schemas have been loaded and the registries is consistent
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadWithDeps( String... schemas ) throws Exception;
+ boolean loadWithDeps( String... schemas ) throws LdapException;
/**
@@ -136,9 +136,9 @@ public interface SchemaManager
*
* @param schemas the Schemas to load, if enabled
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadRelaxed( Schema... schemas ) throws Exception;
+ boolean loadRelaxed( Schema... schemas ) throws LdapException;
/**
@@ -152,9 +152,9 @@ public interface SchemaManager
*
* @param schemas the Schemas' name to load, if enabled
* @return true if the schemas have been loaded and the registries is consistent
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadRelaxed( String... schemas ) throws Exception;
+ boolean loadRelaxed( String... schemas ) throws LdapException;
/**
@@ -168,9 +168,9 @@ public interface SchemaManager
*
* @param schemas the Schemas to load
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadWithDepsRelaxed( Schema... schemas ) throws Exception;
+ boolean loadWithDepsRelaxed( Schema... schemas ) throws LdapException;
/**
@@ -184,9 +184,9 @@ public interface SchemaManager
*
* @param schemas the Schemas' name to load
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadWithDepsRelaxed( String... schemas ) throws Exception;
+ boolean loadWithDepsRelaxed( String... schemas ) throws LdapException;
/**
@@ -199,9 +199,9 @@ public interface SchemaManager
*
* @param schemas The Schemas to load
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadDisabled( Schema... schemas ) throws Exception;
+ boolean loadDisabled( Schema... schemas ) throws LdapException;
/**
@@ -214,7 +214,7 @@ public interface SchemaManager
*
* @param schemas The Schemas' name to load
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
boolean loadDisabled( String... schemas ) throws LdapException;
@@ -224,9 +224,9 @@ public interface SchemaManager
* any inconsistent schema will be rejected.
*
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadAllEnabled() throws Exception;
+ boolean loadAllEnabled() throws LdapException;
/**
@@ -234,9 +234,9 @@ public interface SchemaManager
* even inconsistent schema will be loaded.
*
* @return true if the schemas have been loaded
- * @throws Exception @TODO
+ * @throws LdapException @TODO
*/
- boolean loadAllEnabledRelaxed() throws Exception;
+ boolean loadAllEnabledRelaxed() throws LdapException;
/**
@@ -245,7 +245,7 @@ public interface SchemaManager
* @param schemas The list of Schema to unload
* @return True if all the schemas have been unloaded
*/
- boolean unload( Schema... schemas ) throws Exception;
+ boolean unload( Schema... schemas ) throws LdapException;
/**
@@ -271,7 +271,7 @@ public interface SchemaManager
* @return true if the Registries is still consistent, false otherwise.
* @throws If something went wrong
*/
- boolean enable( Schema... schemas ) throws Exception;
+ boolean enable( Schema... schemas ) throws LdapException;
/**
@@ -351,7 +351,7 @@ public interface SchemaManager
* @return true if the Registries is still consistent, false otherwise.
* @throws If something went wrong
*/
- boolean disable( Schema... schemas ) throws Exception;
+ boolean disable( Schema... schemas ) throws LdapException;
/**
@@ -448,9 +448,9 @@ public interface SchemaManager
*
* @param schemas The schemas to check
* @return true if the schemas can be loaded in the registries
- * @throws Exception if something went wrong
+ * @throws LdapException if something went wrong
*/
- boolean verify( Schema... schemas ) throws Exception;
+ boolean verify( Schema... schemas ) throws LdapException;
/**
@@ -458,9 +458,9 @@ public interface SchemaManager
*
* @param schemas The schema names to check
* @return true if the schemas can be loaded in the registries
- * @throws Exception if something went wrong
+ * @throws LdapException if something went wrong
*/
- boolean verify( String... schemas ) throws Exception;
+ boolean verify( String... schemas ) throws LdapException;
/**
@@ -669,9 +669,9 @@ public interface SchemaManager
/**
* Initializes the SchemaService
*
- * @throws Exception If the initialization fails
+ * @throws LdapException If the initialization fails
*/
- void initialize() throws Exception;
+ void initialize() throws LdapException;
/**
@@ -724,7 +724,7 @@ public interface SchemaManager
*
* @param schemaObject the SchemaObject to unregister
* @return true if the deletion has been made, false if there were some errors
- * @throws Exception if the SchemaObject is not registered or
+ * @throws LdapException if the SchemaObject is not registered or
* the deletion operation is not supported
*/
boolean delete( SchemaObject schemaObject ) throws LdapException;
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java Tue Feb 23 17:20:46 2016
@@ -20,6 +20,7 @@
package org.apache.directory.api.ldap.model.schema.registries;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -33,6 +34,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Value;
+import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.util.StringConstants;
import org.apache.directory.api.util.Strings;
@@ -58,7 +60,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public final Collection<Schema> getAllEnabled() throws Exception
+ public final Collection<Schema> getAllEnabled()
{
Collection<Schema> enabledSchemas = new ArrayList<Schema>();
@@ -77,7 +79,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public final Collection<Schema> getAllSchemas() throws Exception
+ public final Collection<Schema> getAllSchemas()
{
return schemaMap.values();
}
@@ -115,9 +117,9 @@ public abstract class AbstractSchemaLoad
*
* @param entry the entry
* @return the schema
- * @throws Exception the exception
+ * @throws LdapException the exception
*/
- protected Schema getSchema( Entry entry ) throws Exception
+ protected Schema getSchema( Entry entry ) throws LdapException
{
if ( entry == null )
{
@@ -188,7 +190,7 @@ public abstract class AbstractSchemaLoad
}
- private Schema[] buildSchemaArray( String... schemaNames ) throws Exception
+ private Schema[] buildSchemaArray( String... schemaNames ) throws LdapException
{
Schema[] schemas = new Schema[schemaNames.length];
int pos = 0;
@@ -205,7 +207,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadAttributeTypes( String... schemaNames ) throws Exception
+ public List<Entry> loadAttributeTypes( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -219,7 +221,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadComparators( String... schemaNames ) throws Exception
+ public List<Entry> loadComparators( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -233,7 +235,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadDitContentRules( String... schemaNames ) throws Exception
+ public List<Entry> loadDitContentRules( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -247,7 +249,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadDitStructureRules( String... schemaNames ) throws Exception
+ public List<Entry> loadDitStructureRules( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -261,7 +263,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadMatchingRules( String... schemaNames ) throws Exception
+ public List<Entry> loadMatchingRules( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -275,7 +277,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadMatchingRuleUses( String... schemaNames ) throws Exception
+ public List<Entry> loadMatchingRuleUses( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -289,7 +291,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadNameForms( String... schemaNames ) throws Exception
+ public List<Entry> loadNameForms( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -303,7 +305,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadNormalizers( String... schemaNames ) throws Exception
+ public List<Entry> loadNormalizers( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -317,7 +319,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadObjectClasses( String... schemaNames ) throws Exception
+ public List<Entry> loadObjectClasses( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -331,7 +333,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadSyntaxes( String... schemaNames ) throws Exception
+ public List<Entry> loadSyntaxes( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
@@ -345,7 +347,7 @@ public abstract class AbstractSchemaLoad
/**
* {@inheritDoc}
*/
- public List<Entry> loadSyntaxCheckers( String... schemaNames ) throws Exception
+ public List<Entry> loadSyntaxCheckers( String... schemaNames ) throws LdapException, IOException
{
if ( schemaNames == null )
{
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/SchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/SchemaLoader.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/SchemaLoader.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/SchemaLoader.java Tue Feb 23 17:20:46 2016
@@ -49,7 +49,7 @@ public interface SchemaLoader
* a list of specified schema
*
* @param schemas the schemas from which AttributeTypes are loaded
- * @throws Exception if there are failures accessing AttributeType information
+ * @throws LdapException if there are failures accessing AttributeType information
*/
List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException;
@@ -59,9 +59,9 @@ public interface SchemaLoader
* a list of specific schema, using their name
*
* @param schemaNames the schema names from which AttributeTypes are loaded
- * @throws Exception if there are failures accessing AttributeType information
+ * @throws LdapException if there are failures accessing AttributeType information
*/
- List<Entry> loadAttributeTypes( String... schemaNames ) throws Exception;
+ List<Entry> loadAttributeTypes( String... schemaNames ) throws LdapException, IOException;
/**
@@ -69,7 +69,7 @@ public interface SchemaLoader
* a list of specific schema.
*
* @param schemas the schemas from which Comparators are loaded
- * @throws Exception if there are failures accessing Comparator information
+ * @throws LdapException if there are failures accessing Comparator information
*/
List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException;
@@ -79,9 +79,9 @@ public interface SchemaLoader
* a list of specific schema, using their name
*
* @param schemaNames the schema names from which Comparators are loaded
- * @throws Exception if there are failures accessing Comparator information
+ * @throws LdapException if there are failures accessing Comparator information
*/
- List<Entry> loadComparators( String... schemaNames ) throws Exception;
+ List<Entry> loadComparators( String... schemaNames ) throws LdapException, IOException;
/**
@@ -89,7 +89,7 @@ public interface SchemaLoader
* a list of specific schema.
*
* @param schemas the schemas from which DitContentRules are loaded
- * @throws Exception if there are failures accessing DitContentRule information
+ * @throws LdapException if there are failures accessing DitContentRule information
*/
List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException;
@@ -99,9 +99,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which DitContentRules are loaded
- * @throws Exception if there are failures accessing DitContentRule information
+ * @throws LdapException if there are failures accessing DitContentRule information
*/
- List<Entry> loadDitContentRules( String... schemaNames ) throws Exception;
+ List<Entry> loadDitContentRules( String... schemaNames ) throws LdapException, IOException;
/**
@@ -109,7 +109,7 @@ public interface SchemaLoader
* a list of specific schema.
*
* @param schemas the schemas from which DitStructureRules are loaded
- * @throws Exception if there are failures accessing DitStructureRule information
+ * @throws LdapException if there are failures accessing DitStructureRule information
*/
List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException;
@@ -119,9 +119,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which DitStructureRules are loaded
- * @throws Exception if there are failures accessing DitStructureRule information
+ * @throws LdapException if there are failures accessing DitStructureRule information
*/
- List<Entry> loadDitStructureRules( String... schemaNames ) throws Exception;
+ List<Entry> loadDitStructureRules( String... schemaNames ) throws LdapException, IOException;
/**
@@ -129,7 +129,7 @@ public interface SchemaLoader
* a list of specific schema
*
* @param schemas the schemas from which MatchingRules are loaded
- * @throws Exception if there are failures accessing MatchingRule information
+ * @throws LdapException if there are failures accessing MatchingRule information
*/
List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException;
@@ -139,9 +139,9 @@ public interface SchemaLoader
* a list of specific schema, using their name
*
* @param schemaNames the schema names from which MatchingRules are loaded
- * @throws Exception if there are failures accessing MatchingRule information
+ * @throws LdapException if there are failures accessing MatchingRule information
*/
- List<Entry> loadMatchingRules( String... schemaNames ) throws Exception;
+ List<Entry> loadMatchingRules( String... schemaNames ) throws LdapException, IOException;
/**
@@ -149,7 +149,7 @@ public interface SchemaLoader
* a list of specific schema.
*
* @param schemas the schemas from which MatchingRuleUses are loaded
- * @throws Exception if there are failures accessing MatchingRuleUse information
+ * @throws LdapException if there are failures accessing MatchingRuleUse information
*/
List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException;
@@ -159,9 +159,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which MatchingRuleUses are loaded
- * @throws Exception if there are failures accessing MatchingRuleUses information
+ * @throws LdapException if there are failures accessing MatchingRuleUses information
*/
- List<Entry> loadMatchingRuleUses( String... schemaNames ) throws Exception;
+ List<Entry> loadMatchingRuleUses( String... schemaNames ) throws LdapException, IOException;
/**
@@ -169,7 +169,7 @@ public interface SchemaLoader
* a list of specific schema.
*
* @param schemas the schemas from which NameForms are loaded
- * @throws Exception if there are failures accessing NameForm information
+ * @throws LdapException if there are failures accessing NameForm information
*/
List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException;
@@ -179,9 +179,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which NameForms are loaded
- * @throws Exception if there are failures accessing NameForms information
+ * @throws LdapException if there are failures accessing NameForms information
*/
- List<Entry> loadNameForms( String... schemaNames ) throws Exception;
+ List<Entry> loadNameForms( String... schemaNames ) throws LdapException, IOException;
/**
@@ -189,7 +189,7 @@ public interface SchemaLoader
* a list of specified schema
*
* @param schemas the schemas from which Normalizers are loaded
- * @throws Exception if there are failures accessing Normalizer information
+ * @throws LdapException if there are failures accessing Normalizer information
*/
List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException;
@@ -199,9 +199,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which Normalizers are loaded
- * @throws Exception if there are failures accessing Normalizer information
+ * @throws LdapException if there are failures accessing Normalizer information
*/
- List<Entry> loadNormalizers( String... schemaNames ) throws Exception;
+ List<Entry> loadNormalizers( String... schemaNames ) throws LdapException, IOException;
/**
@@ -209,7 +209,7 @@ public interface SchemaLoader
* a list of specific schema.
*
* @param schemas the schemas from which ObjectClasses are loaded
- * @throws Exception if there are failures accessing ObjectClass information
+ * @throws LdapException if there are failures accessing ObjectClass information
*/
List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException;
@@ -219,9 +219,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which ObjectClasses are loaded
- * @throws Exception if there are failures accessing ObjectClasses information
+ * @throws LdapException if there are failures accessing ObjectClasses information
*/
- List<Entry> loadObjectClasses( String... schemaNames ) throws Exception;
+ List<Entry> loadObjectClasses( String... schemaNames ) throws LdapException, IOException;
/**
@@ -229,7 +229,7 @@ public interface SchemaLoader
* a list of specified schema
*
* @param schemas the schemas from which Syntaxes are loaded
- * @throws Exception if there are failures accessing Syntax information
+ * @throws LdapException if there are failures accessing Syntax information
*/
List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException;
@@ -239,9 +239,9 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which Syntaxes are loaded
- * @throws Exception if there are failures accessing Syntax information
+ * @throws LdapException if there are failures accessing Syntax information
*/
- List<Entry> loadSyntaxes( String... schemaNames ) throws Exception;
+ List<Entry> loadSyntaxes( String... schemaNames ) throws LdapException, IOException;
/**
@@ -249,7 +249,7 @@ public interface SchemaLoader
* a list of specified schema
*
* @param schemas the schemas from which SyntaxCheckers are loaded
- * @throws Exception if there are failures accessing SyntaxChecker information
+ * @throws LdapException if there are failures accessing SyntaxChecker information
*/
List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException;
@@ -259,23 +259,23 @@ public interface SchemaLoader
* a list of specified schema names
*
* @param schemaNames the schema names from which SyntaxCheckers are loaded
- * @throws Exception if there are failures accessing SyntaxChecker information
+ * @throws LdapException if there are failures accessing SyntaxChecker information
*/
- List<Entry> loadSyntaxCheckers( String... schemaNames ) throws Exception;
+ List<Entry> loadSyntaxCheckers( String... schemaNames ) throws LdapException, IOException;
/**
* @return the list of enabled schemas
- * @throws Exception TODO
+ * @throws LdapException TODO
*/
- Collection<Schema> getAllEnabled() throws Exception;
+ Collection<Schema> getAllEnabled();
/**
* @return the list of all schemas
- * @throws Exception TODO
+ * @throws LdapException TODO
*/
- Collection<Schema> getAllSchemas() throws Exception;
+ Collection<Schema> getAllSchemas();
/**
Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java Tue Feb 23 17:20:46 2016
@@ -687,4 +687,10 @@ public class DnParserTest
}
}
+
+ @Test
+ public void testSameAttributeInDn() throws LdapInvalidDnException
+ {
+ //Dn dn = new Dn( "l=eu + l=de + l=Berlin + l=Brandenburger Tor,dc=example,dc=org" );
+ }
}
Added: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/PrepareStringTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/PrepareStringTest.java?rev=1731906&view=auto
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/PrepareStringTest.java (added)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/PrepareStringTest.java Tue Feb 23 17:20:46 2016
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.api.ldap.model.schema;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+/**
+ * Tests for the PrepareString class
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class PrepareStringTest
+{
+
+ @Test
+ public void testEscapeBackSlash() throws IOException
+ {
+ String result = PrepareString.normalize( "C:\\a\\b\\c", PrepareString.StringType.DIRECTORY_STRING );
+ System.out.println( result );
+ }
+}
Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/EntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/EntityFactory.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/EntityFactory.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/EntityFactory.java Tue Feb 23 17:20:46 2016
@@ -44,9 +44,9 @@ public interface EntityFactory
*
* @param entry The Schema entry
* @return An instance of a Schema
- * @throws Exception If the instance can't be created
+ * @throws LdapException If the instance can't be created
*/
- Schema getSchema( Entry entry ) throws Exception;
+ Schema getSchema( Entry entry ) throws LdapException;
/**
@@ -71,11 +71,11 @@ public interface EntityFactory
* @param targetRegistries The registries containing all the enabled SchemaObjects
* @param schemaName The schema this SchemaObject will be part of
* @return A new instance of a LdapComparator
- * @throws Exception If the creation has failed
+ * @throws LdapException If the creation has failed
*/
LdapComparator<?> getLdapComparator( SchemaManager schemaManager,
LdapComparatorDescription comparatorDescription,
- Registries targetRegistries, String schemaName ) throws Exception;
+ Registries targetRegistries, String schemaName ) throws LdapException;
/**
@@ -114,10 +114,10 @@ public interface EntityFactory
* @param targetRegistries The registries containing all the enabled SchemaObjects
* @param schemaName The schema this SchemaObject will be part of
* @return A new instance of a normalizer
- * @throws Exception If the creation has failed
+ * @throws LdapException If the creation has failed
*/
Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription,
- Registries targetRegistries, String schemaName ) throws Exception;
+ Registries targetRegistries, String schemaName ) throws LdapException;
/**
@@ -141,7 +141,7 @@ public interface EntityFactory
* @param targetRegistries The registries containing all the enabled SchemaObjects
* @param schemaName The schema this SchemaObject will be part of
* @return
- * @throws Exception
+ * @throws LdapException
*/
ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName )
throws LdapException;
@@ -182,8 +182,8 @@ public interface EntityFactory
* @param targetRegistries The registries containing all the enabled SchemaObjects
* @param schemaName The schema this SchemaObject will be part of
* @return A new instance of a syntaxChecker
- * @throws Exception If the creation has failed
+ * @throws LdapException If the creation has failed
*/
SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription syntaxCheckerDescription,
- Registries targetRegistries, String schemaName ) throws Exception;
+ Registries targetRegistries, String schemaName ) throws LdapException;
}
Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java Tue Feb 23 17:20:46 2016
@@ -79,10 +79,10 @@ public class JarLdifSchemaLoader extends
* sure the supplied base directory exists and contains a schema.ldif file
* and if not complains about it.
*
- * @throws Exception if the base directory does not exist or does not
+ * @throws LdapException if the base directory does not exist or does not
* a valid schema.ldif file
*/
- public JarLdifSchemaLoader() throws Exception
+ public JarLdifSchemaLoader() throws IOException, LdapException
{
initializeSchemas();
}
@@ -105,9 +105,9 @@ public class JarLdifSchemaLoader extends
* Scans for LDIF files just describing the various schema contained in
* the schema repository.
*
- * @throws Exception
+ * @throws LdapException
*/
- private void initializeSchemas() throws Exception
+ private void initializeSchemas() throws IOException, LdapException
{
if ( IS_DEBUG )
{
@@ -137,10 +137,10 @@ public class JarLdifSchemaLoader extends
LOG.debug( "Schema Initialized ... \n{}", schema );
}
}
- catch ( Exception e )
+ catch ( LdapException le )
{
- LOG.error( I18n.err( I18n.ERR_10003, file ), e );
- throw e;
+ LOG.error( I18n.err( I18n.ERR_10003, file ), le );
+ throw le;
}
finally
{
Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java Tue Feb 23 17:20:46 2016
@@ -81,10 +81,10 @@ public class LdifSchemaLoader extends Ab
* and if not complains about it.
*
* @param baseDirectory the schema LDIF base directory
- * @throws Exception if the base directory does not exist or does not
+ * @throws LdapException if the base directory does not exist or does not
* a valid schema.ldif file
*/
- public LdifSchemaLoader( File baseDirectory ) throws Exception
+ public LdifSchemaLoader( File baseDirectory ) throws LdapException, IOException
{
this.baseDirectory = baseDirectory;
@@ -117,9 +117,9 @@ public class LdifSchemaLoader extends Ab
* Scans for LDIF files just describing the various schema contained in
* the schema repository.
*
- * @throws Exception
+ * @throws LdapException
*/
- private void initializeSchemas() throws Exception
+ private void initializeSchemas() throws LdapException, IOException
{
if ( IS_DEBUG )
{
@@ -155,7 +155,7 @@ public class LdifSchemaLoader extends Ab
LOG.debug( "Schema Initialized ... \n{}", schema );
}
}
- catch ( Exception e )
+ catch ( LdapException e )
{
LOG.error( I18n.err( I18n.ERR_10003, ldifFile ), e );
throw e;
Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java Tue Feb 23 17:20:46 2016
@@ -21,6 +21,7 @@ package org.apache.directory.api.ldap.sc
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -39,6 +40,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.api.ldap.model.exception.LdapSchemaException;
import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException;
import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -269,8 +271,7 @@ public class SchemaEntityFactory impleme
* Class load a syntaxChecker instance
*/
private SyntaxChecker classLoadSyntaxChecker( SchemaManager schemaManager, String oid, String className,
- Attribute byteCode )
- throws Exception
+ Attribute byteCode ) throws LdapException
{
// Try to class load the syntaxChecker
Class<?> clazz = null;
@@ -279,17 +280,48 @@ public class SchemaEntityFactory impleme
if ( byteCode == null )
{
- clazz = Class.forName( className );
+ try
+ {
+ clazz = Class.forName( className );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ LOG.error( "Cannot find the syntax checker class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot find the syntax checker class " + cnfe.getMessage() );
+ }
}
else
{
classLoader.setAttribute( byteCode );
- clazz = classLoader.loadClass( className );
+
+ try
+ {
+ clazz = classLoader.loadClass( className );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ LOG.error( "Cannot load the syntax checker class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot load the syntax checker class " + cnfe.getMessage() );
+ }
+
byteCodeStr = new String( Base64.encode( byteCode.getBytes() ) );
}
// Create the syntaxChecker instance
- syntaxChecker = ( SyntaxChecker ) clazz.newInstance();
+ try
+ {
+ syntaxChecker = ( SyntaxChecker ) clazz.newInstance();
+ }
+ catch ( InstantiationException ie )
+ {
+ LOG.error( "Cannot instantiate the syntax checker class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot instantiate the syntax checker class " + ie.getMessage() );
+ }
+ catch ( IllegalAccessException iae )
+ {
+ LOG.error( "Cannot access the syntax checker class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot access the syntax checker class constructor " + iae.getMessage() );
+ }
// Update the common fields
syntaxChecker.setBytecode( byteCodeStr );
@@ -364,7 +396,7 @@ public class SchemaEntityFactory impleme
*/
public SyntaxChecker getSyntaxChecker( SchemaManager schemaManager,
SyntaxCheckerDescription syntaxCheckerDescription, Registries targetRegistries, String schemaName )
- throws Exception
+ throws LdapException
{
checkDescription( syntaxCheckerDescription, SchemaConstants.SYNTAX_CHECKER );
@@ -402,7 +434,7 @@ public class SchemaEntityFactory impleme
* Class load a comparator instances
*/
private LdapComparator<?> classLoadComparator( SchemaManager schemaManager, String oid, String className,
- Attribute byteCode ) throws Exception
+ Attribute byteCode ) throws LdapException
{
// Try to class load the comparator
LdapComparator<?> comparator = null;
@@ -411,12 +443,30 @@ public class SchemaEntityFactory impleme
if ( byteCode == null )
{
- clazz = Class.forName( className );
+ try
+ {
+ clazz = Class.forName( className );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ LOG.error( "Cannot find the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot find the comparator class " + cnfe.getMessage() );
+ }
}
else
{
classLoader.setAttribute( byteCode );
- clazz = classLoader.loadClass( className );
+
+ try
+ {
+ clazz = classLoader.loadClass( className );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ LOG.error( "Cannot load the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot load the comparator class " + cnfe.getMessage() );
+ }
+
byteCodeStr = new String( Base64.encode( byteCode.getBytes() ) );
}
@@ -426,16 +476,57 @@ public class SchemaEntityFactory impleme
{
Constructor<?> constructor = clazz.getConstructor( new Class[]
{ String.class } );
- comparator = ( LdapComparator<?> ) constructor.newInstance( new Object[]
- { oid } );
+
+ try
+ {
+ comparator = ( LdapComparator<?> ) constructor.newInstance( new Object[]
+ { oid } );
+ }
+ catch ( InvocationTargetException ite )
+ {
+ LOG.error( "Cannot invoke the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot invoke the comparator class " + ite.getMessage() );
+ }
+ catch ( InstantiationException ie )
+ {
+ LOG.error( "Cannot instanciate the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot instanciate the comparator class " + ie.getMessage() );
+ }
+ catch ( IllegalAccessException ie )
+ {
+ LOG.error( "Cannot access the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot access the comparator class " + ie.getMessage() );
+ }
}
catch ( NoSuchMethodException nsme )
{
// Ok, let's try with the constructor without argument.
// In this case, we will have to check that the OID is the same than
// the one we got in the Comparator entry
- clazz.getConstructor();
- comparator = ( LdapComparator<?> ) clazz.newInstance();
+ try
+ {
+ clazz.getConstructor();
+ }
+ catch ( NoSuchMethodException nsme2 )
+ {
+ LOG.error( "Cannot find the comparator class constructor method for class {}", className );
+ throw new LdapSchemaException( "Cannot find the comparator class constructor method" + nsme2.getMessage() );
+ }
+
+ try
+ {
+ comparator = ( LdapComparator<?> ) clazz.newInstance();
+ }
+ catch ( InstantiationException ie )
+ {
+ LOG.error( "Cannot instantiate the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot instantiate the comparator class " + ie.getMessage() );
+ }
+ catch ( IllegalAccessException iae )
+ {
+ LOG.error( "Cannot access the comparator class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot access the comparator class constructor " + iae.getMessage() );
+ }
if ( !comparator.getOid().equals( oid ) )
{
@@ -460,7 +551,7 @@ public class SchemaEntityFactory impleme
*/
public LdapComparator<?> getLdapComparator( SchemaManager schemaManager,
LdapComparatorDescription comparatorDescription, Registries targetRegistries, String schemaName )
- throws Exception
+ throws LdapException
{
checkDescription( comparatorDescription, SchemaConstants.COMPARATOR );
@@ -552,7 +643,7 @@ public class SchemaEntityFactory impleme
* Class load a normalizer instances
*/
private Normalizer classLoadNormalizer( SchemaManager schemaManager, String oid, String className,
- Attribute byteCode ) throws Exception
+ Attribute byteCode ) throws LdapException
{
// Try to class load the normalizer
Class<?> clazz = null;
@@ -561,17 +652,48 @@ public class SchemaEntityFactory impleme
if ( byteCode == null )
{
- clazz = Class.forName( className );
+ try
+ {
+ clazz = Class.forName( className );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ LOG.error( "Cannot find the normalizer class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot find the normalizer class " + cnfe.getMessage() );
+ }
}
else
{
classLoader.setAttribute( byteCode );
- clazz = classLoader.loadClass( className );
+
+ try
+ {
+ clazz = classLoader.loadClass( className );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ LOG.error( "Cannot load the normalizer class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot load the normalizer class " + cnfe.getMessage() );
+ }
+
byteCodeStr = new String( Base64.encode( byteCode.getBytes() ) );
}
// Create the normalizer instance
- normalizer = ( Normalizer ) clazz.newInstance();
+ try
+ {
+ normalizer = ( Normalizer ) clazz.newInstance();
+ }
+ catch ( InstantiationException ie )
+ {
+ LOG.error( "Cannot instantiate the normalizer class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot instantiate the normalizer class " + ie.getMessage() );
+ }
+ catch ( IllegalAccessException iae )
+ {
+ LOG.error( "Cannot access the normalizer class constructor for class {}", className );
+ throw new LdapSchemaException( "Cannot access the normalizer class constructor " + iae.getMessage() );
+ }
// Update the common fields
normalizer.setBytecode( byteCodeStr );
@@ -591,7 +713,7 @@ public class SchemaEntityFactory impleme
* {@inheritDoc}
*/
public Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription,
- Registries targetRegistries, String schemaName ) throws Exception
+ Registries targetRegistries, String schemaName ) throws LdapException
{
checkDescription( normalizerDescription, SchemaConstants.NORMALIZER );
Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java Tue Feb 23 17:20:46 2016
@@ -89,7 +89,11 @@ public class SingleLdifSchemaLoader exte
initializeSchemas( in );
}
- catch ( Exception e )
+ catch ( LdapException e )
+ {
+ throw new RuntimeException( e );
+ }
+ catch ( IOException e )
{
throw new RuntimeException( e );
}
@@ -111,7 +115,11 @@ public class SingleLdifSchemaLoader exte
initializeSchemas( in );
}
- catch ( Exception e )
+ catch ( LdapException e )
+ {
+ throw new RuntimeException( e );
+ }
+ catch ( IOException e )
{
throw new RuntimeException( e );
}
@@ -121,7 +129,7 @@ public class SingleLdifSchemaLoader exte
/**
* Initialize the Schema object from a Single LDIF file
*/
- private void initializeSchemas( InputStream in ) throws Exception
+ private void initializeSchemas( InputStream in ) throws LdapException, IOException
{
LdifReader ldifReader = new LdifReader( in );
@@ -151,7 +159,7 @@ public class SingleLdifSchemaLoader exte
/**
* Load all the schemaObjects
*/
- private void loadSchemaObject( String schemaName, LdifEntry ldifEntry ) throws Exception
+ private void loadSchemaObject( String schemaName, LdifEntry ldifEntry ) throws LdapException
{
for ( String scObjTypeRdn : schemaObjectTypeRdns )
{
Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=1731906&r1=1731905&r2=1731906&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java Tue Feb 23 17:20:46 2016
@@ -127,23 +127,36 @@ public class DefaultSchemaManager implem
/**
* Creates a new instance of DefaultSchemaManager with the default schema schemaLoader
*/
- public DefaultSchemaManager() throws Exception
+ public DefaultSchemaManager()
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;
- SchemaLoader schemaLoader = new JarLdifSchemaLoader();
-
-
- for ( Schema schema : schemaLoader.getAllSchemas() )
- {
- schemaMap.put( schema.getSchemaName(), schema );
- }
-
errors = new ArrayList<Throwable>();
registries = new Registries();
factory = new SchemaEntityFactory();
isRelaxed = STRICT;
- loadAllEnabled();
+
+ try
+ {
+ SchemaLoader schemaLoader = new JarLdifSchemaLoader();
+
+ for ( Schema schema : schemaLoader.getAllSchemas() )
+ {
+ schemaMap.put( schema.getSchemaName(), schema );
+ }
+
+ loadAllEnabled();
+ }
+ catch ( LdapException le )
+ {
+ LOG.error( "SchemaManager can't be loaded : {}", le.getMessage() );
+ throw new RuntimeException( le.getMessage() );
+ }
+ catch ( IOException ioe )
+ {
+ LOG.error( "SchemaManager can't be loaded : {}", ioe.getMessage() );
+ throw new RuntimeException( ioe.getMessage() );
+ }
}
@@ -152,7 +165,7 @@ public class DefaultSchemaManager implem
*
* @param schemas The list of schema to load
*/
- public DefaultSchemaManager( Collection<Schema> schemas ) throws Exception
+ public DefaultSchemaManager( Collection<Schema> schemas )
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;
@@ -175,7 +188,7 @@ public class DefaultSchemaManager implem
*
* @param schemaLoader The schemaLoader containing the schemas to load
*/
- public DefaultSchemaManager( SchemaLoader schemaLoader ) throws Exception
+ public DefaultSchemaManager( SchemaLoader schemaLoader )
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;
@@ -199,7 +212,7 @@ public class DefaultSchemaManager implem
* @param relaxed If the schema manager should be relaxed or not
* @param schemas The list of schema to load
*/
- public DefaultSchemaManager( boolean relaxed, Collection<Schema> schemas ) throws Exception
+ public DefaultSchemaManager( boolean relaxed, Collection<Schema> schemas )
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;
@@ -711,7 +724,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean load( String... schemaNames ) throws Exception
+ public boolean load( String... schemaNames ) throws LdapException
{
if ( schemaNames.length == 0 )
{
@@ -1064,7 +1077,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadAllEnabled() throws Exception
+ public boolean loadAllEnabled() throws LdapException
{
Schema[] schemas = new Schema[schemaMap.size()];
int i = 0;
@@ -1087,7 +1100,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadAllEnabledRelaxed() throws Exception
+ public boolean loadAllEnabledRelaxed() throws LdapException
{
Schema[] enabledSchemas = new Schema[schemaMap.size()];
int i = 0;
@@ -1162,7 +1175,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadRelaxed( Schema... schemas ) throws Exception
+ public boolean loadRelaxed( Schema... schemas ) throws LdapException
{
// TODO Auto-generated method stub
return false;
@@ -1172,7 +1185,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadRelaxed( String... schemaNames ) throws Exception
+ public boolean loadRelaxed( String... schemaNames ) throws LdapException
{
Schema[] schemas = toArray( schemaNames );
return loadRelaxed( schemas );
@@ -1182,7 +1195,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadWithDeps( Schema... schemas ) throws Exception
+ public boolean loadWithDeps( Schema... schemas ) throws LdapException
{
boolean loaded = false;
@@ -1238,7 +1251,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadWithDeps( String... schemas ) throws Exception
+ public boolean loadWithDeps( String... schemas ) throws LdapException
{
return loadWithDeps( toArray( schemas ) );
}
@@ -1254,7 +1267,7 @@ public class DefaultSchemaManager implem
* @throws Exception if there is a cycle detected and/or another
* failure results while loading, producing and or registering schema objects
*/
- private void loadDepsFirst( Registries registries, Schema schema ) throws Exception
+ private void loadDepsFirst( Registries registries, Schema schema ) throws LdapException
{
if ( schema == null )
{
@@ -1314,7 +1327,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadWithDepsRelaxed( Schema... schemas ) throws Exception
+ public boolean loadWithDepsRelaxed( Schema... schemas ) throws LdapException
{
registries.setRelaxed();
@@ -1337,7 +1350,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean loadWithDepsRelaxed( String... schemas ) throws Exception
+ public boolean loadWithDepsRelaxed( String... schemas ) throws LdapException
{
return loadWithDepsRelaxed( toArray( schemas ) );
}
@@ -1352,7 +1365,7 @@ public class DefaultSchemaManager implem
* @throws Exception if there is a cycle detected and/or another
* failure results while loading, producing and or registering schema objects
*/
- private void loadDepsFirstRelaxed( Schema schema ) throws Exception
+ private void loadDepsFirstRelaxed( Schema schema ) throws LdapException
{
if ( schema == null )
{
@@ -1503,7 +1516,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean verify( Schema... schemas ) throws Exception
+ public boolean verify( Schema... schemas ) throws LdapException
{
// Work on a cloned registries
Registries clonedRegistries = cloneRegistries();
@@ -1551,7 +1564,7 @@ public class DefaultSchemaManager implem
/**
* {@inheritDoc}
*/
- public boolean verify( String... schemas ) throws Exception
+ public boolean verify( String... schemas ) throws LdapException
{
return verify( toArray( schemas ) );
}
@@ -1571,7 +1584,7 @@ public class DefaultSchemaManager implem
*
* @throws Exception If the initialization fails
*/
- public void initialize() throws Exception
+ public void initialize() throws LdapException
{
}