You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/10/09 13:15:00 UTC
[tomcat] branch 9.0.x updated: Fix BZ 64784. Don't include
timestamp in .java file when pre-compiling
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new dd6298a Fix BZ 64784. Don't include timestamp in .java file when pre-compiling
dd6298a is described below
commit dd6298af2726fc5be58fd65460dfc117e2c329e5
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Oct 9 14:02:50 2020 +0100
Fix BZ 64784. Don't include timestamp in .java file when pre-compiling
---
java/org/apache/jasper/JspC.java | 13 +++++++++++++
java/org/apache/jasper/Options.java | 11 +++++++++++
java/org/apache/jasper/compiler/Generator.java | 6 ++++--
webapps/docs/changelog.xml | 6 ++++++
4 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/jasper/JspC.java b/java/org/apache/jasper/JspC.java
index f211f31..15f983d 100644
--- a/java/org/apache/jasper/JspC.java
+++ b/java/org/apache/jasper/JspC.java
@@ -1136,6 +1136,19 @@ public class JspC extends Task implements Options {
return tagPluginManager;
}
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Hard-coded to {@code false} for pre-compiled code to enable repeatable
+ * builds.
+ */
+ @Override
+ public boolean getGeneratedJavaAddTimestamp() {
+ return false;
+ }
+
+
/**
* Adds servlet declaration and mapping for the JSP page servlet to the
* generated web.xml fragment.
diff --git a/java/org/apache/jasper/Options.java b/java/org/apache/jasper/Options.java
index 9d0fbf9..248750a 100644
--- a/java/org/apache/jasper/Options.java
+++ b/java/org/apache/jasper/Options.java
@@ -256,4 +256,15 @@ public interface Options {
* the quoting rules in JSP.1.6 applied to the expression.
*/
public boolean getQuoteAttributeEL();
+
+ /**
+ * Should the container include the time the file was generated in the
+ * comments at the start of a Java file generated from a JSP or tag.
+ * Defaults to {@code true}.
+ *
+ * @return {@code true} to include the timestamp, otherwise don't include it
+ */
+ public default boolean getGeneratedJavaAddTimestamp() {
+ return true;
+ }
}
diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 656e122..7f8f7d6 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3680,8 +3680,10 @@ class Generator {
out.println("/*");
out.println(" * Generated by the Jasper component of Apache Tomcat");
out.println(" * Version: " + ctxt.getServletContext().getServerInfo());
- out.println(" * Generated at: " + timestampFormat.format(new Date()) +
- " UTC");
+ if (ctxt.getOptions().getGeneratedJavaAddTimestamp()) {
+ out.println(" * Generated at: " + timestampFormat.format(new Date()) +
+ " UTC");
+ }
out.println(" * Note: The last modified time of this file was set to");
out.println(" * the last modified time of the source file after");
out.println(" * generation to assist with modification tracking.");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 07b69ba..8696eb9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -74,6 +74,12 @@
<subsection name="Jasper">
<changelog>
<fix>
+ <bug>64784</bug>: Don't include the time the Java file was generated as
+ a comment when generating Java files for JSPs and/or tags if the Java
+ file was created during pre-compilation. This is to aid repeatable
+ builds. (markt)
+ </fix>
+ <fix>
<bug>64794</bug>: Security exception reading system property on
JspRuntimeLibrary use. (remm)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org