}
catch (NoSuchMethodException nsme) {
StringBuilder msg = new StringBuilder( "Unable to instantiate analyzer class: " );
msg.append( classToInstantiate.getName() );
msg.append( ". Class neither has a default constructor nor a constructor with a Version parameter" );
throw new SearchException( msg.toString(), e );
}
}
try {
if ( useVersionParameter ) {
analyzerInstance = (Analyzer) constructor.newInstance( luceneMatchVersion );
}
else {
analyzerInstance = (Analyzer) constructor.newInstance();
}
}
catch (IllegalAccessException e) {
throw new SearchException(
"Unable to instantiate analyzer class: " + classToInstantiate.getName() +
". Class or constructor is not accessible.", e
);
}
catch (InstantiationException e) {
throw new SearchException(
"Unable to instantiate analyzer class: " + classToInstantiate.getName() +
". Verify it has a no-args public constructor and is not abstract.", e
);
}
catch (InvocationTargetException e) {
throw new SearchException(
"Unable to instantiate analyzer class: " + classToInstantiate.getName() +
". Verify it has a no-args public constructor and is not abstract."
+ " Also Analyzer implementation classes or their tokenStream() and reusableTokenStream() implementations must be final.",
e
);