{
clazz = Class.forName( className );
}
catch ( ClassNotFoundException e )
{
LdapNamingException ne = new LdapNamingException( "Comparator class "+ className + " was not found",
ResultCodeEnum.OTHER );
ne.setRootCause( e );
throw ne;
}
}
else
{
classLoader.setAttribute( bytecode );
try
{
clazz = classLoader.loadClass( className );
}
catch ( ClassNotFoundException e )
{
LdapNamingException ne = new LdapNamingException( "Comparator class "+ className + " was not found",
ResultCodeEnum.OTHER );
ne.setRootCause( e );
throw ne;
}
}
try
{
comparator = ( Comparator ) clazz.newInstance();
}
catch ( InstantiationException e )
{
NamingException ne = new NamingException( "Failed to instantiate comparator class "+ className
+ ".\nCheck that a default constructor exists for the class." );
ne.setRootCause( e );
throw ne;
}
catch ( IllegalAccessException e )
{
NamingException ne = new NamingException( "Failed to instantiate comparator class "+ className
+ ".\nCheck that a **PUBLIC** accessible default constructor exists for the class." );
ne.setRootCause( e );
throw ne;
}
injectRegistries( comparator, targetRegistries );
return comparator;