You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sc...@apache.org on 2011/04/07 23:22:13 UTC

svn commit: r1090022 - in /tomcat/trunk/java/org/apache/jasper: compiler/Compiler.java resources/LocalStrings.properties

Author: schultz
Date: Thu Apr  7 21:22:12 2011
New Revision: 1090022

URL: http://svn.apache.org/viewvc?rev=1090022&view=rev
Log:
Added warning messages when an exception is thrown while trying to delete files.
Replaced duplicate code in removeGeneratedFiles with a call to removeGeneratedClassFiles.

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java
    tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=1090022&r1=1090021&r2=1090022&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java Thu Apr  7 21:22:12 2011
@@ -555,23 +555,8 @@ public abstract class Compiler {
      * Remove generated files
      */
     public void removeGeneratedFiles() {
-        try {
-            String classFileName = ctxt.getClassFileName();
-            if (classFileName != null) {
-                File classFile = new File(classFileName);
-                if (log.isDebugEnabled())
-                    log.debug("Deleting " + classFile);
-                if (classFile.exists()) {
-                    if (!classFile.delete()) {
-                        log.warn(Localizer.getMessage(
-                                "jsp.warning.compiler.classfile.delete.fail",
-                                classFile.getAbsolutePath()));
-                    }
-                }
-            }
-        } catch (Exception e) {
-            // Remove as much as possible, ignore possible exceptions
-        }
+        removeGeneratedClassFiles();
+
         try {
             String javaFileName = ctxt.getServletJavaFileName();
             if (javaFileName != null) {
@@ -587,7 +572,9 @@ public abstract class Compiler {
                 }
             }
         } catch (Exception e) {
-            // Remove as much as possible, ignore possible exceptions
+            // Remove as much as possible, log possible exceptions
+            log.warn(Localizer.getMessage("jsp.warning.compiler.classfile.delete.fail.unknown"),
+                     e);
         }
     }
 
@@ -607,7 +594,9 @@ public abstract class Compiler {
                 }
             }
         } catch (Exception e) {
-            // Remove as much as possible, ignore possible exceptions
+            // Remove as much as possible, log possible exceptions
+            log.warn(Localizer.getMessage("jsp.warning.compiler.classfile.delete.fail.unknown"),
+                     e);
         }
     }
 }

Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1090022&r1=1090021&r2=1090022&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Thu Apr  7 21:22:12 2011
@@ -228,7 +228,9 @@ jsp.warning.compiler.class.cantcreate=Ca
 jsp.warning.compiler.class.notfound=Specified compiler plugin class {0} not found. Will default to Sun Java Compiler.
 jsp.warning.compiler.path.notfound=Specified compiler path {0} not found. Will default to system PATH.
 jsp.warning.compiler.classfile.delete.fail=Failed to delete generated class file [{0}] 
+jsp.warning.compiler.classfile.delete.fail.unknown=Failed to delete generated class file(s)
 jsp.warning.compiler.javafile.delete.fail=Failed to delete generated Java file [{0}] 
+jsp.warning.compiler.javafile.delete.fail.unknown=Failed to delete generated Java file(s)
 jsp.error.jspc.uriroot_not_dir=The -uriroot option must specify a pre-existing directory
 jsp.error.jspc.missingTarget=Missing target: Must specify -webapp or -uriroot, or one or more JSP pages
 jsp.error.jspc.no_uriroot=The uriroot is not specified and cannot be located with the specified JSP file(s)
@@ -484,4 +486,4 @@ jsp.message.jsp_removed_excess=Removing 
 jsp.message.jsp_removed_idle=Removing idle JSP for path [{0}] in context [{1}] after {2} seconds");
 jsp.message.jsp_unload_check=Checking JSPs for unload in context [{0}], JSP count: {1} queue length: {2}
 
-xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream
\ No newline at end of file
+xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream



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