tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [tomcat] branch 8.5.x updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63897 JSP timestamps
Date Mon, 04 Nov 2019 15:24:58 GMT
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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 2d3a570  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63897 JSP timestamps
2d3a570 is described below

commit 2d3a5703e358365d43ed7c2e30632ec67d996b3b
Author: Mark Thomas <markt@apache.org>
AuthorDate: Mon Nov 4 15:13:00 2019 +0000

    Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63897 JSP timestamps
    
    Capture the timestamp of a JSP for the purposes of modification tracking
    before the JSP is compiled to prevent a race condition if the JSP is
    modified during compilation. Patch provided by Karl von Randow.
    
    Additional changes to better align 9.0.x and 8.5.x.
---
 java/org/apache/jasper/compiler/Compiler.java               | 11 ++++++++---
 java/org/apache/jasper/resources/LocalStrings.properties    |  1 +
 java/org/apache/jasper/resources/LocalStrings_fr.properties |  1 +
 java/org/apache/jasper/resources/LocalStrings_ja.properties |  1 +
 java/org/apache/jasper/resources/LocalStrings_ko.properties |  1 +
 webapps/docs/changelog.xml                                  | 10 ++++++++++
 6 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Compiler.java b/java/org/apache/jasper/compiler/Compiler.java
index 1a6132f..9cf955a 100644
--- a/java/org/apache/jasper/compiler/Compiler.java
+++ b/java/org/apache/jasper/compiler/Compiler.java
@@ -370,17 +370,22 @@ public abstract class Compiler {
         }
 
         try {
+            final Long jspLastModified = ctxt.getLastModified(ctxt.getJspFile());
             String[] smap = generateJava();
             File javaFile = new File(ctxt.getServletJavaFileName());
-            Long jspLastModified = ctxt.getLastModified(ctxt.getJspFile());
-            javaFile.setLastModified(jspLastModified.longValue());
+            if (!javaFile.setLastModified(jspLastModified.longValue())) {
+                throw new JasperException(Localizer.getMessage("jsp.error.setLastModified",
javaFile));
+            }
             if (compileClass) {
                 generateClass(smap);
                 // Fix for bugzilla 41606
                 // Set JspServletWrapper.servletClassLastModifiedTime after successful compile
                 File targetFile = new File(ctxt.getClassFileName());
                 if (targetFile.exists()) {
-                    targetFile.setLastModified(jspLastModified.longValue());
+                    if (!targetFile.setLastModified(jspLastModified.longValue())) {
+                        throw new JasperException(
+                                Localizer.getMessage("jsp.error.setLastModified", targetFile));
+                    }
                     if (jsw != null) {
                         jsw.setServletClassLastModifiedTime(
                                 jspLastModified.longValue());
diff --git a/java/org/apache/jasper/resources/LocalStrings.properties b/java/org/apache/jasper/resources/LocalStrings.properties
index b770462..20ad2c7 100644
--- a/java/org/apache/jasper/resources/LocalStrings.properties
+++ b/java/org/apache/jasper/resources/LocalStrings.properties
@@ -170,6 +170,7 @@ jsp.error.quotes.unterminated=Unterminated quotes
 jsp.error.scripting.variable.missing_name=Unable to determine scripting variable name from
attribute [{0}]
 jsp.error.servlet.destroy.failed=Exception during Servlet.destroy() for JSP page
 jsp.error.servlet.invalid.method=JSPs only permit GET POST or HEAD
+jsp.error.setLastModified=Unable to set last modified date for file [{0}]
 jsp.error.signature.classnotfound=The class [{0}] specified in the method signature in TLD
for the function [{1}] cannot be found. [{2}]
 jsp.error.simpletag.badbodycontent=The TLD for the class [{0}] specifies an invalid body-content
(JSP) for a SimpleTag.
 jsp.error.single.line.number=An error occurred at line: [{0}] in the jsp file: [{1}]
diff --git a/java/org/apache/jasper/resources/LocalStrings_fr.properties b/java/org/apache/jasper/resources/LocalStrings_fr.properties
index 4a0ab2b..6e0d1e6 100644
--- a/java/org/apache/jasper/resources/LocalStrings_fr.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_fr.properties
@@ -169,6 +169,7 @@ jsp.error.prolog_pagedir_encoding_mismatch=L''encodage spécifié dans
le prolog
 jsp.error.quotes.unterminated=Guillemets non terminés
 jsp.error.scripting.variable.missing_name=Incapable de déterminer le nom de variable scripting
d''après l''attribut [{0}]
 jsp.error.servlet.destroy.failed=Erreur pendant le Servlet.destroy() de la page JSP
+jsp.error.setLastModified=Impossible de fixer la date de dernière modification pour le fichier
[{0}]
 jsp.error.signature.classnotfound=La classe [{0}] spećifié dans la signature de la méthode
dans la TLD pour la fonction [{1}] n''a pas pu être trouvée [{2}]
 jsp.error.simpletag.badbodycontent=La TLD de la classe [{0}] spécifie un body-content (JSP)
invalide pour un tag simple (SimpleTag).
 jsp.error.single.line.number=Une erreur s''est produite à la ligne: [{0}] dans le fichier
jsp: [{1}]
diff --git a/java/org/apache/jasper/resources/LocalStrings_ja.properties b/java/org/apache/jasper/resources/LocalStrings_ja.properties
index 7c77773..c936750 100644
--- a/java/org/apache/jasper/resources/LocalStrings_ja.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_ja.properties
@@ -169,6 +169,7 @@ jsp.error.prolog_pagedir_encoding_mismatch=XML導入部で指定されたpage-en
 jsp.error.quotes.unterminated=引用符が終了していません
 jsp.error.scripting.variable.missing_name=属性 [{0}] からスクリプト変数名を決定できません
 jsp.error.servlet.destroy.failed=JSPページのServlet.destroy()の例外
+jsp.error.setLastModified=ファイル[{0}]の最終更新日を設定できません
 jsp.error.signature.classnotfound=TLDの中のメソッドシグネチャで関数 [{1}]
に指定されているクラス [{0}] が見つかりません。 [{2}]
 jsp.error.simpletag.badbodycontent=クラス [{0}] のTLDはSimpleTagに無効なbody-content
(JSP)を指定しています
 jsp.error.single.line.number=JSPファイル: [{1}] の中の[{0}]行目でエラーが発生しました
diff --git a/java/org/apache/jasper/resources/LocalStrings_ko.properties b/java/org/apache/jasper/resources/LocalStrings_ko.properties
index caca55d..1ef05d4 100644
--- a/java/org/apache/jasper/resources/LocalStrings_ko.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_ko.properties
@@ -168,6 +168,7 @@ jsp.error.prolog_pagedir_encoding_mismatch=XML 프롤로그 [{0}]에 지정된

 jsp.error.quotes.unterminated=종료되지 않은 인용부들
 jsp.error.scripting.variable.missing_name=속성 [{0}](으)로부터 스크립팅 변수
이름을 결정할 수 없습니다.
 jsp.error.servlet.destroy.failed=JSP 페이지를 위한 Servlet.destroy() 호출 중 예외
발생
+jsp.error.setLastModified=파일 [{0}]의 최종 변경 시간을 설정할 수 없습니다.
 jsp.error.signature.classnotfound=TLD 내에 function [{1}]을 위해 지정된 메소드
signature에 포함된 클래스 [{0}]을(를) 찾을 수 없습니다. [{2}]
 jsp.error.simpletag.badbodycontent=클래스 [{0}]을(를) 위한 TLD가 SimpleTag로서
유효하지 않은 body-content (JSP)를 지정하고 있습니다.
 jsp.error.single.line.number=JSP 파일 [{1}]의 [{0}] 행에서 오류가 발생했습니다.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 91cc103..18d35cc 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -106,6 +106,16 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>63897</bug>: Capture the timestamp of a JSP for the purposes of
+        modification tracking before the JSP is compiled to prevent a race
+        condition if the JSP is modified during compilation. Patch provided by
+        Karl von Randow. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>


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


Mime
View raw message