This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 36291e6af5629a4bb019f74fd0be829e3287b7fa Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Nov 13 22:48:44 2019 +0000 SpotBugs fixes (incomplete) for Jasper --- java/org/apache/jasper/compiler/AntCompiler.java | 5 ++++- java/org/apache/jasper/compiler/Compiler.java | 3 ++- java/org/apache/jasper/compiler/JDTCompiler.java | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java/org/apache/jasper/compiler/AntCompiler.java b/java/org/apache/jasper/compiler/AntCompiler.java index bf2a2f8..0d0bcb4 100644 --- a/java/org/apache/jasper/compiler/AntCompiler.java +++ b/java/org/apache/jasper/compiler/AntCompiler.java @@ -249,7 +249,10 @@ public class AntCompiler extends Compiler { if (!ctxt.keepGenerated()) { File javaFile = new File(javaFileName); - javaFile.delete(); + if (!javaFile.delete()) { + throw new JasperException(Localizer.getMessage( + "jsp.warning.compiler.javafile.delete.fail", javaFile)); + } } if (be != null) { diff --git a/java/org/apache/jasper/compiler/Compiler.java b/java/org/apache/jasper/compiler/Compiler.java index 9cf955a..02278b5 100644 --- a/java/org/apache/jasper/compiler/Compiler.java +++ b/java/org/apache/jasper/compiler/Compiler.java @@ -77,6 +77,7 @@ public abstract class Compiler { this.options = ctxt.getOptions(); } + // --------------------------------------------------------- Public Methods /** @@ -264,7 +265,7 @@ public abstract class Compiler { + " generate=" + (t4 - t3) + " validate=" + (t2 - t1)); } - } catch (Exception e) { + } catch (RuntimeException e) { // Remove the generated .java file File file = new File(javaFileName); if (file.exists()) { diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java index 4950f3f..1d0f0b7 100644 --- a/java/org/apache/jasper/compiler/JDTCompiler.java +++ b/java/org/apache/jasper/compiler/JDTCompiler.java @@ -540,7 +540,10 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler { if (!ctxt.keepGenerated()) { File javaFile = new File(ctxt.getServletJavaFileName()); - javaFile.delete(); + if (!javaFile.delete()) { + throw new JasperException(Localizer.getMessage( + "jsp.warning.compiler.javafile.delete.fail", javaFile)); + } } if (!problemList.isEmpty()) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org