Bug 64784

Summary: Add option to remove date from generated Java header comment
Product: Tomcat 10 Reporter: niklas
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ------   
Hardware: All   
OS: All   

Description niklas 2020-10-02 08:57:20 UTC
Currently, org.apache.jasper.compiler.Generator#generateCommentHeader writes the current timestamp using `new Date()` into the comment header, which makes builds keeping sources non-reproducible, because the timestamp changes with each precompile.

There should be an option to disable or override this timestamp or maybe it can be removed completely?
Comment 1 Michael Osipov 2020-10-02 10:58:27 UTC
I would favor to remove it completely. It adds zero benefit.
Comment 2 Mark Thomas 2020-10-02 11:32:48 UTC
The date was added to the .java file to aid trouble shooting JSP compilation issues and remind system admins that the last modified time of the file will reflect the last modified time of the JSP source rather than the time the file was generated.

As far as I recall this wasn't requested by users but was something we added proactively when we started changing the last modified time although it would be worth a trawl through the archives to confirm my recollection.

I'm not against removing it entirely. I've done a fair amount of debugging of JSP generation and I don't recall using it. If we wanted to be cautious we could probably remove it when precompiling but leave it when compiling on demand.
Comment 3 Christopher Schultz 2020-10-02 14:45:26 UTC
+1 to at least removing it from a precompile.
Comment 4 Mark Thomas 2020-10-09 13:20:00 UTC
Fixed in:
- 10.0.x for 10.0.0-M10 onwards
- 9.0.x for 9.0.40 onwards

Disabled for pre-compiled files. Retained for on-the-fly compilation.