tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r439565 - in /tomcat/tc6.0.x/trunk/java/org/apache/jasper: JspCompilationContext.java compiler/Compiler.java servlet/JspServletWrapper.java
Date Sat, 02 Sep 2006 09:28:36 GMT
Author: remm
Date: Sat Sep  2 02:28:35 2006
New Revision: 439565

URL: http://svn.apache.org/viewvc?rev=439565&view=rev
Log:
- Separate processing of exceptions from the servlet (so that IOE doesn't cause problems anymore:
bug 38713).
- Only Compiler will attempt to remove the files (before the compilation), otherwise multiple
things can happen
  in parallel.
- Code cleanup (I suppose I'll have to do a big cleanup soon ...).

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspCompilationContext.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=439565&r1=439564&r2=439565&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspCompilationContext.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspCompilationContext.java Sat Sep  2 02:28:35
2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -73,7 +73,6 @@
     private String classPath;
 
     private String baseURI;
-    private String baseOutputDir;
     private String outputDir;
     private ServletContext context;
     private URLClassLoader loader;
@@ -538,10 +537,8 @@
     // ==================== Removal ==================== 
 
     public void incrementRemoved() {
-        if (removed > 1) {
-            jspCompiler.removeGeneratedFiles();
-            if( rctxt != null )
-                rctxt.removeWrapper(jspUri);
+        if (removed == 0 && rctxt != null) {
+            rctxt.removeWrapper(jspUri);
         }
         removed++;
     }
@@ -559,6 +556,7 @@
         createCompiler();
         if (isPackagedTagFile || jspCompiler.isOutDated()) {
             try {
+                jspCompiler.removeGeneratedFiles();
                 jspLoader = null;
                 jspCompiler.compile();
                 jsw.setReload(true);
@@ -568,7 +566,6 @@
                 jsw.setCompilationException(ex);
                 throw ex;
             } catch (Exception ex) {
-                ex.printStackTrace();
                 JasperException je = new JasperException(
                             Localizer.getMessage("jsp.error.unable.compile"),
                             ex);

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=439565&r1=439564&r2=439565&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java Sat Sep  2 02:28:35
2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004-2005 The Apache Software Foundation.
+ * Copyright 1999,2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -373,7 +373,6 @@
             jspRealLastModified = uc.getLastModified();
             uc.getInputStream().close();
         } catch (Exception e) {
-            e.printStackTrace();
             return true;
         }
 
@@ -430,7 +429,6 @@
                     return true;
                 }
             } catch (Exception e) {
-                e.printStackTrace();
                 return true;
             }
         }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=439565&r1=439564&r2=439565&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java Sat Sep  2
02:28:35 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004-2005 The Apache Software Foundation.
+ * Copyright 1999,2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -288,6 +288,7 @@
                         HttpServletResponse response,
                         boolean precompile)
 	    throws ServletException, IOException, FileNotFoundException {
+        
         try {
 
             if (ctxt.isRemoved()) {
@@ -328,6 +329,53 @@
                 return;
             }
 
+        } catch (FileNotFoundException ex) {
+            ctxt.incrementRemoved();
+            String includeRequestUri = (String)
+                request.getAttribute("javax.servlet.include.request_uri");
+            if (includeRequestUri != null) {
+                // This file was included. Throw an exception as
+                // a response.sendError() will be ignored by the
+                // servlet engine.
+                throw new ServletException(ex);
+            } else {
+                try {
+                    response.sendError(HttpServletResponse.SC_NOT_FOUND, 
+                                      ex.getMessage());
+                } catch (IllegalStateException ise) {
+                    log.error(Localizer.getMessage("jsp.error.file.not.found",
+                           ex.getMessage()),
+                  ex);
+                }
+            }
+        } catch (ServletException ex) {
+            if (options.getDevelopment()) {
+                throw handleJspException(ex);
+            } else {
+                throw ex;
+            }
+        } catch (IOException ex) {
+            if (options.getDevelopment()) {
+                throw handleJspException(ex);
+            } else {
+                throw ex;
+            }
+        } catch (IllegalStateException ex) {
+            if (options.getDevelopment()) {
+                throw handleJspException(ex);
+            } else {
+                throw ex;
+            }
+        } catch (Exception ex) {
+            if (options.getDevelopment()) {
+                throw handleJspException(ex);
+            } else {
+                throw new JasperException(ex);
+            }
+        }
+
+        try {
+            
             /*
              * (3) Service request
              */
@@ -359,25 +407,6 @@
                 response.sendError
                     (HttpServletResponse.SC_SERVICE_UNAVAILABLE, 
                      ex.getMessage());
-            }
-        } catch (FileNotFoundException ex) {
-            ctxt.incrementRemoved();
-            String includeRequestUri = (String)
-                request.getAttribute("javax.servlet.include.request_uri");
-            if (includeRequestUri != null) {
-                // This file was included. Throw an exception as
-                // a response.sendError() will be ignored by the
-                // servlet engine.
-                throw new ServletException(ex);
-            } else {
-                try {
-                    response.sendError(HttpServletResponse.SC_NOT_FOUND, 
-                                      ex.getMessage());
-                } catch (IllegalStateException ise) {
-                    log.error(Localizer.getMessage("jsp.error.file.not.found",
-						   ex.getMessage()),
-			      ex);
-                }
             }
         } catch (ServletException ex) {
             if(options.getDevelopment()) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message