if ( byName.containsKey( oid ) )
{
String msg = I18n.err( I18n.ERR_04270, schemaObjectType.name(), oid );
LOG.warn( msg );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, msg );
ldapSchemaException.setSourceObject( schemaObject );
throw ldapSchemaException;
}
byName.put( oid, schemaObject );
/*
* add the aliases/names to the name map along with their toLowerCase
* versions of the name: this is used to make sure name lookups work
*/
for ( String name : schemaObject.getNames() )
{
String lowerName = Strings.trim( Strings.toLowerCase( name ) );
if ( byName.containsKey( lowerName ) )
{
String msg = I18n.err( I18n.ERR_04271, schemaObjectType.name(), name );
LOG.warn( msg );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.NAME_ALREADY_REGISTERED, msg );
ldapSchemaException.setSourceObject( schemaObject );
throw ldapSchemaException;
}
else
{
byName.put( lowerName, schemaObject );