Author: peterreilly
Date: Mon Nov 13 13:11:42 2006
New Revision: 474520
URL: http://svn.apache.org/viewvc?view=rev&rev=474520
Log:
Bugzilla 38249: add quiet to loadfile
Modified:
ant/core/trunk/CONTRIBUTORS
ant/core/trunk/WHATSNEW
ant/core/trunk/contributors.xml
ant/core/trunk/docs/manual/CoreTasks/loadfile.html
ant/core/trunk/docs/manual/CoreTasks/loadresource.html
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadResource.java
Modified: ant/core/trunk/CONTRIBUTORS
URL:
http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?view=diff&rev=474520&r1=474519&r2=474520
==============================================================================
Binary files - no diff available.
Modified: ant/core/trunk/WHATSNEW
URL:
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=474520&r1=474519&r2=474520
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Nov 13 13:11:42 2006
@@ -29,6 +29,9 @@
* add dtd to javadoc for junit.
Bugzilla 40754.
+* add quiet attribute to loadfile/resource.
+ Bugzilla 38249.
+
Changes from Ant 1.7.0Beta3 to Ant 1.7.0RC1
===========================================
Modified: ant/core/trunk/contributors.xml
URL:
http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?view=diff&rev=474520&r1=474519&r2=474520
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Mon Nov 13 13:11:42 2006
@@ -961,6 +961,10 @@
<last>Morin</last>
</name>
<name>
+ <first>Steve</first>
+ <last>Wadsworth</last>
+ </name>
+ <name>
<first>Steven</first>
<middle>E.</middle>
<last>Newton</last>
Modified: ant/core/trunk/docs/manual/CoreTasks/loadfile.html
URL:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/loadfile.html?view=diff&rev=474520&r1=474519&r2=474520
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/loadfile.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/loadfile.html Mon Nov 13 13:11:42 2006
@@ -59,6 +59,17 @@
<td valign="top">Whether to halt the build on failure</td>
<td align="center" valign="top">No, default "true"</td>
</tr>
+ <tr>
+ <td valign="top">quiet</td>
+ <td valign="top">Do not display a diagnostic message (unless Ant has been
+ invoked with the <code>-verbose</code> or <code>-debug</code>
+ switches) or modify the exit status to reflect an error. Setting this to
+ "true" implies setting failonerror to "false".
+ <em>Since Ant 1.7.0.</em>
+ </td>
+ <td align="center" valign="top">No, default "false"</td>
+ </tr>
+
</table>
<p>
The LoadFile task supports nested <a href="../CoreTypes/filterchain.html">
Modified: ant/core/trunk/docs/manual/CoreTasks/loadresource.html
URL:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/loadresource.html?view=diff&rev=474520&r1=474519&r2=474520
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/loadresource.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/loadresource.html Mon Nov 13 13:11:42
2006
@@ -58,6 +58,15 @@
<td valign="top">Whether to halt the build on failure</td>
<td align="center" valign="top">No, default "true"</td>
</tr>
+ <tr>
+ <td valign="top">quiet</td>
+ <td valign="top">Do not display a diagnostic message (unless Ant has been
+ invoked with the <code>-verbose</code> or <code>-debug</code>
+ switches) or modify the exit status to reflect an error. Setting this to
+ "true" implies setting failonerror to "false".
+ </td>
+ <td align="center" valign="top">No, default "false"</td>
+ </tr>
</table>
<p>
The LoadResource task supports nested <a href="../CoreTypes/filterchain.html">
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadResource.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadResource.java?view=diff&rev=474520&r1=474519&r2=474520
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadResource.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadResource.java Mon
Nov 13 13:11:42 2006
@@ -51,6 +51,12 @@
private boolean failOnError = true;
/**
+ * suppress error message if it goes pear-shaped, sets failOnError=false
+ */
+ private boolean quiet = false;
+
+
+ /**
* Encoding to use for filenames, defaults to the platform's default
* encoding.
*/
@@ -100,7 +106,18 @@
public final void setFailonerror(final boolean fail) {
failOnError = fail;
}
-
+
+ /**
+ * If true, suppress the load error report and set the
+ * the failonerror value to true.
+ * @param quiet The new Quiet value
+ */
+ public void setQuiet(final boolean quiet) {
+ this.quiet = quiet;
+ if (quiet) {
+ this.failOnError = false;
+ }
+ }
/**
* read in a source file to a property
@@ -116,12 +133,16 @@
if (property == null) {
throw new BuildException("output property not defined");
}
+ if (quiet && failOnError) {
+ throw new BuildException("quiet and failonerror cannot both be "
+ + "set to true");
+ }
if (!src.isExists()) {
String message = src + " doesn't exist";
if (failOnError) {
throw new BuildException(message);
} else {
- log(message, Project.MSG_ERR);
+ log(message, quiet ? Project.MSG_WARN : Project.MSG_ERR);
return;
}
}
@@ -175,13 +196,14 @@
if (failOnError) {
throw new BuildException(message, ioe, getLocation());
} else {
- log(message, Project.MSG_ERR);
+ log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_ERR);
}
} catch (final BuildException be) {
if (failOnError) {
throw be;
} else {
- log(be.getMessage(), Project.MSG_ERR);
+ log(be.getMessage(),
+ quiet ? Project.MSG_VERBOSE : Project.MSG_ERR);
}
} finally {
FileUtils.close(is);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]