https://bz.apache.org/bugzilla/show_bug.cgi?id=59379
Bug ID: 59379
Summary: Get task not quiet if dest file exists
Product: Ant
Version: 1.9.6
Hardware: PC
OS: other
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
Assignee: [email protected]
Reporter: [email protected]
Created attachment 33806
--> https://bz.apache.org/bugzilla/attachment.cgi?id=33806&action=edit
Test case
# Overview
The Get task is not quiet when the `dest' file exists and the `quiet' and
`skipexisting' attributes are set to `true'; it displays a message like this:
[get] Destination already exists (skipping): /tmp/ant-get-test/mylib.jar
# Steps to Reproduce
1. Save the attached build.xml file to the directory /tmp/ant-get-test (or
wherever)
2. Run Ant in the directory:
$ ant
# Actual Results
Buildfile: /tmp/ant-get-test/build.xml
build:
[touch] Creating /tmp/ant-get-test/mylib.jar
[get] Destination already exists (skipping): /tmp/ant-get-test/mylib.jar
BUILD SUCCESSFUL
Total time: 0 seconds
# Expected Results
The Get task should not write the message about the destination file already
existing because the `quiet' attribute is set to `true':
Buildfile: /tmp/ant-get-test/build.xml
build:
[touch] Creating /tmp/ant-get-test/mylib.jar
BUILD SUCCESSFUL
Total time: 0 seconds
# Build Date & Hardware
Ant 1.9.6 on OS X El Capitan (10.11.4).
# Additional Builds and Platforms
I haven't tested on other platforms, but the problem probably exists
everywhere.
# Additional Information
Looking at the source code for the Get task from the Git master branch, it
seems like one fix would be to only call the `log' method if the `quiet'
attribute is not set to `true' as in the attached get-quiet-skip-existing.diff
(untested).
Another approach would be to change the `log(String, int)' method to use a
different conditional for the `msgLevel' test. Right now, it uses `msgLevel >=
Project.MSG_ERR', but in Project, MSG_ERR, MSG_WARN, MSG_INFO, MSG_VERBOSE, and
MSG_DEBUG are set to 0-4, respectively, so the `msgLevel >= Project.MSG_ERR'
test will always evaluate to true (and hence the super.log call will always be
made) unless a value less than 0 is specified (i.e. not one of the Project
class constants).
--
You are receiving this mail because:
You are the assignee for the bug.