Description: Improves the reproducibility of the javadoc task for the Debian
 builds by setting the locale to 'en' and the encoding to UTF-8 if none was
 specified and SOURCE_DATE_EPOCH is set.
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -1807,6 +1807,16 @@
      */
     @Override
     public void execute() throws BuildException {
+        if (System.getenv("SOURCE_DATE_EPOCH") != null) {
+            java.util.List<String> arguments = java.util.Arrays.asList(cmd.getCommandline());
+            if (!arguments.contains("-locale")) {
+                setLocale("en");
+            }
+            if (!arguments.contains("-encoding")) {
+                setEncoding("UTF-8");
+            }
+        }
+
         checkTaskName();
 
         final List<String> packagesToDoc = new Vector<>();
