}
} catch(Exception e) {
throw new JasperException("No output directory: " + e.getMessage());
}
boolean firstTime = jsw.servletClass == null;
JspCompilationContext ctxt = new JspEngineContext(parentClassLoader, classpath,
context, jspUri, outDir.toString() + File.separator,
isErrorPage, options,
req, res);
boolean outDated = false;
Compiler compiler = ctxt.createCompiler();
try {
outDated = compiler.compile();
if ( (jsw.servletClass == null) || (compiler.isOutDated()) ) {
synchronized ( this ) {
if ((jsw.servletClass == null) ||
(compiler.isOutDated() )) {
outDated = compiler.compile();
}
}
}
} catch (FileNotFoundException ex) {
compiler.removeGeneratedFiles();
throw ex;
} catch (JasperException ex) {
throw ex;
} catch (Exception ex) {
throw new JasperException(Constants.getString("jsp.error.unable.compile"),
ex);
}
// Reload only if it's outdated
if((jsw.servletClass == null) || outDated) {
try {
URL [] urls = new URL[1];
File outputDir = new File(normalize(ctxt.getOutputDir()));
urls[0] = outputDir.toURL();
jsw.loader = new JasperLoader(urls,ctxt.getServletClassName(),
parentClassLoader,
permissionCollection,
codeSource);
jsw.servletClass = jsw.loader.loadClass(
Constants.JSP_PACKAGE_NAME + "." + ctxt.getServletClassName());
} catch (ClassNotFoundException cex) {
throw new JasperException(
Constants.getString("jsp.error.unable.load"),cex);
} catch (MalformedURLException mue) {
throw new JasperException(