Attribute byteCode )
throws Exception
{
// Try to class load the syntaxChecker
Class<?> clazz = null;
SyntaxChecker syntaxChecker = null;
String byteCodeStr = StringConstants.EMPTY;
if ( byteCode == null )
{
clazz = Class.forName( className );
}
else
{
classLoader.setAttribute( byteCode );
clazz = classLoader.loadClass( className );
byteCodeStr = new String( Base64.encode( byteCode.getBytes() ) );
}
// Create the syntaxChecker instance
syntaxChecker = ( SyntaxChecker ) clazz.newInstance();
// Update the common fields
syntaxChecker.setBytecode( byteCodeStr );
syntaxChecker.setFqcn( className );
// Inject the new OID, as the loaded syntaxChecker might have its own
syntaxChecker.setOid( oid );
// Inject the SchemaManager for the comparator who needs it
syntaxChecker.setSchemaManager( schemaManager );
return syntaxChecker;
}