ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38249] - LoadFile task should support "quiet"
Date Fri, 13 Jan 2006 15:33:06 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38249





------- Additional Comments From lizzardo@ix.netcom.com  2006-01-13 16:33 -------
(From update of attachment 17405)
--- LoadFile.java.orig	2005-06-02 16:19:58.000000000 -0700
+++ LoadFile.java	2006-01-13 07:25:55.947056800 -0800
@@ -48,6 +48,11 @@
     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.
      */
@@ -57,7 +62,7 @@
      * name of property
      */
     private String property = null;
-
+    
     /**
      * Holds FilterChains
      */
@@ -109,6 +114,16 @@
	 failOnError = fail;
     }

+    /**
+     * If true
+     * @param quiet The new Quiet value
+     */
+    public void setQuiet(boolean quiet) {
+	 this.quiet = quiet;
+	 if (quiet) {
+	     this.failOnError = false;
+	 }
+    }

     /**
      * read in a source file to a property
@@ -124,6 +139,10 @@
	 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");
+	 }
	 FileInputStream fis = null;
	 BufferedInputStream bis = null;
	 Reader instream = null;
@@ -169,7 +188,8 @@
	     if (failOnError) {
		 throw new BuildException(message, ioe, getLocation());
	     } else {
-		 log(message, Project.MSG_ERR);
+		 log(message, quiet ? Project.MSG_VERBOSE
+				    : Project.MSG_WARN);
	     }
	 } catch (final BuildException be) {
	     if (failOnError) {


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message