remm 02/04/29 16:03:06
Modified: jasper2/src/share/org/apache/jasper/servlet JspServlet.java
Log:
- Simplify the compile and load class algorithm, and unify them in a single synced
block.
- Fix obvious bug when reloading=false.
Revision Changes Path
1.7 +29 -35
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
Index: JspServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JspServlet.java 29 Apr 2002 22:39:46 -0000 1.6
+++ JspServlet.java 29 Apr 2002 23:03:06 -0000 1.7
@@ -598,55 +598,49 @@
boolean outDated = false;
Compiler compiler = ctxt.createCompiler();
- try {
- if (options.getReloading()) {
+ if (options.getReloading() || (jsw.servletClass == null)) {
+ try {
synchronized (jsw) {
+
// Synchronizing on jsw enables simultaneous
// compilations of different pages, but not the
// same page.
outDated = compiler.isOutDated();
if (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 {
- synchronized (jsw) {
- if (jsw.servletClass == null || outDated) {
- URL [] urls = new URL[1];
- File outputDir = new File(normalize(ctxt.getOutputDir()));
+ if ((jsw.servletClass == null) || outDated) {
+ 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) {
+ jsw.loader = new JasperLoader
+ (urls,ctxt.getServletClassName(),
+ parentClassLoader, permissionCollection,
+ codeSource);
+ jsw.servletClass = jsw.loader.loadClass
+ (Constants.JSP_PACKAGE_NAME + "."
+ + ctxt.getServletClassName());
+ }
+
+ }
+ } catch (FileNotFoundException ex) {
+ compiler.removeGeneratedFiles();
+ throw ex;
+ } catch (ClassNotFoundException cex) {
throw new JasperException(
Constants.getString("jsp.error.unable.load"),cex);
} catch (MalformedURLException mue) {
throw new JasperException(
Constants.getString("jsp.error.unable.load"),mue);
- }
-
- }
-
+ } catch (JasperException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new JasperException
+ (Constants.getString("jsp.error.unable.compile"), ex);
+ }
+ }
+
return outDated;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>