You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2021/09/05 05:18:25 UTC

[ant] branch master updated: Check for warnings in err stream too, to make javadoc task work on Java 17+

This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new fa91bff  Check for warnings in err stream too, to make javadoc task work on Java 17+
fa91bff is described below

commit fa91bff92e65620d42f14454c465571f34a97ada
Author: Jaikiran Pai <ja...@apache.org>
AuthorDate: Sun Sep 5 10:40:42 2021 +0530

    Check for warnings in err stream too, to make javadoc task work on Java 17+
    
    Discussed in dev list https://mail-archives.apache.org/mod_mbox/ant-dev/202106.mbox/%3c2e2ef67a-7d96-adfc-f050-efaccab7e6c2@apache.org%3e
---
 WHATSNEW                                            | 3 +++
 src/main/org/apache/tools/ant/taskdefs/Javadoc.java | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/WHATSNEW b/WHATSNEW
index 7355945..4c82517 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -27,6 +27,9 @@ Other changes:
  * Ant tries to avoid file name canonicalization when possible.
    Bugzilla Report 65499
 
+ * javadoc task will now look for warning messages in the STDERR stream too
+   when "failonwarning" is set to true to account for changes in JDK 17+
+
 Changes from Ant 1.10.10 TO Ant 1.10.11
 =======================================
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index acc3a65..efee9d3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -1918,7 +1918,7 @@ public class Javadoc extends Task {
                 throw new BuildException("Javadoc returned " + ret,
                                          getLocation());
             }
-            if (out.sawWarnings() && failOnWarning) {
+            if (failOnWarning && (out.sawWarnings() || err.sawWarnings())) {
                 throw new BuildException("Javadoc issued warnings.",
                                          getLocation());
             }
@@ -2623,7 +2623,7 @@ public class Javadoc extends Task {
 
         @Override
         protected void processLine(final String line, final int messageLevel) {
-            if (line.contains("warning")) {
+            if (line.matches("(\\d) warning[s]?$")) {
                 sawWarnings = true;
             }
             if (messageLevel == Project.MSG_INFO