Bug 65647 - Attribute "quiet" of task "LoadResource" not working as described
Summary: Attribute "quiet" of task "LoadResource" not working as described
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.10.12
Hardware: PC
: P2 minor (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2021-10-22 12:14 UTC by michael.luber
Modified: 2021-10-22 12:14 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description michael.luber 2021-10-22 12:14:53 UTC
says about the attribute "quiet":

Do not display a diagnostic message (unless Ant has been invoked with the -verbose or -debug switches)

Using the task "LoadFile" which is derived from "LoadResource", I
found that this does not work. I tried this ANT-script:

<project name="MyProject" default="all">
  <target name="all" >
      <loadfile property="filecontent" srcFile="noSuchFile" quiet="true"/>

which produces:

 [loadfile] D:\git\brake\s7p.build\ant\noSuchFile doesn't exist

The reason for that is that in apache-ant-1.10.12\src\main\org\apache\tools\ant\taskdefs\LoadResource.java, in method execute(), if the file does not exist, we issue

log(message, quiet ? Project.MSG_WARN : Project.MSG_ERR);

which should be

log(message, quiet ? Project.MSG_VERBOSE: Project.MSG_ERR);