// clear exception
this.compileException = null;
try {
final CompilerOptions opts = this.ioProvider.getForceCompileOptions();
final CompilationUnit unit = new CompilationUnit(this.sourcePath, className, ioProvider);
final CompilationResult result = this.ioProvider.getCompiler().compile(new org.apache.sling.commons.compiler.CompilationUnit[] {unit},
opts);
final List<CompilerMessage> errors = result.getErrors();
this.destroy();
if ( errors != null && errors.size() > 0 ) {
throw CompilerException.create(errors, this.sourcePath);
}
final Servlet servlet = (Servlet) result.loadCompiledClass(this.className).newInstance();
servlet.init(this.config);
this.injectFields(servlet);
this.theServlet = servlet;