luehe 2004/04/19 17:05:09
Modified: jasper2/src/share/org/apache/jasper
JspCompilationContext.java
jasper2/src/share/org/apache/jasper/servlet
JspServletWrapper.java
Log:
When in deployment (ie., !development) mode, save any compilation exceptions and
rethrow them (instead of recompiling and getting the same exception over and over
again) until the next scheduled recompilation
Revision Changes Path
1.46 +7 -2
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java
Index: JspCompilationContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- JspCompilationContext.java 17 Mar 2004 19:23:03 -0000 1.45
+++ JspCompilationContext.java 20 Apr 2004 00:05:09 -0000 1.46
@@ -506,12 +506,17 @@
try {
jspCompiler.compile();
jsw.setReload(true);
+ jsw.setCompilationException(null);
} catch (JasperException ex) {
+ jsw.setCompilationException(ex);
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
- throw new
JasperException(Localizer.getMessage("jsp.error.unable.compile"),
- ex);
+ JasperException je = new JasperException(
+ Localizer.getMessage("jsp.error.unable.compile"),
+ ex);
+ jsw.setCompilationException(je);
+ throw je;
}
}
}
1.35 +27 -3
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java
Index: JspServletWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- JspServletWrapper.java 16 Apr 2004 23:01:29 -0000 1.34
+++ JspServletWrapper.java 20 Apr 2004 00:05:09 -0000 1.35
@@ -73,6 +73,7 @@
private boolean reload = true;
private boolean isTagFile;
private int tripCount;
+ private JasperException compileException;
/*
* JspServletWrapper for JSP pages.
@@ -143,8 +144,6 @@
if (!firstTime) {
ctxt.getRuntimeContext().incrementJspReloadCount();
- } else {
- firstTime = false;
}
reload = false;
@@ -158,6 +157,16 @@
return config.getServletContext();
}
+ /*
+ * Sets the compilation exception for this JspServletWrapper.
+ *
+ * @param je The compilation exception
+ */
+ public void setCompilationException(JasperException je) {
+ this.compileException = je;
+ }
+
+
/**
* Compile (if needed) and load a tag file
*/
@@ -169,9 +178,17 @@
}
if (options.getDevelopment() || firstTime ) {
synchronized (this) {
+ if (firstTime) {
+ firstTime = false;
+ }
ctxt.compile();
}
+ } else {
+ if (compileException != null) {
+ throw compileException;
+ }
}
+
if (reload) {
tagHandlerClass = ctxt.load();
}
@@ -249,9 +266,16 @@
Localizer.getMessage("jsp.error.unavailable"));
}
- if (options.getDevelopment() || firstTime ) {
+ if (options.getDevelopment() || firstTime ) {
synchronized (this) {
+ if (firstTime) {
+ firstTime = false;
+ }
ctxt.compile();
+ }
+ } else {
+ if (compileException != null) {
+ throw compileException;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]