Bug 47303 - Copy failonerror is internally inconsistent with Warning message
Summary: Copy failonerror is internally inconsistent with Warning message
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.7.1
Hardware: PC Windows Server 2003
: P2 trivial (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2009-06-02 17:19 UTC by dsuits
Modified: 2009-06-03 11:06 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description dsuits 2009-06-02 17:19:51 UTC

If the source file does not exist, the following log is executed:

                String message = "Warning: Could not find file "
                    + file.getAbsolutePath() + " to copy.";
                if (!failonerror) {
                    log(message, Project.MSG_ERR);
                } else {
                    throw new BuildException(message);

This is inconsistent and misleading.  If it is an error for the file to be missing, then the message is incorrect "Warning:" should be spelled "Error:".  If instead the intent of failonerror is to convert errors to warnings, then the message priority should be Project.MSG_WARN.
Comment 1 Stefan Bodewig 2009-06-03 08:23:19 UTC
There are other places where the code says "Warning" and logs it as ERR in
Copy (lines 441, 504 and 519 in trunk).

While I agree this looks confusing I don't really think we should change it at all.
The change is really more of a cosmetic one and there might be code out there
scanning for the word "Warning".
Comment 2 dsuits 2009-06-03 11:06:29 UTC
The documentation available here:

"If false, log a warning message, but do not stop the build, when the file to copy does not exist or one of the nested filesets points to a directory that doesn't exist or an error occurs while copying."

So build script developers are being told to expect a warning, but BuildEvent consumers (custom BuildListeners) are receiving an error to process.