in src/main/java/org/apache/sling/scripting/java/impl/ServletWrapper.java [239:268]
private void compile()
throws Exception {
logger.debug("Compiling {}", this.sourcePath);
// 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;
} catch (final Exception ex) {
// store exception for futher access attempts
this.compileException = ex;
throw ex;
}
}