You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/01/13 02:23:31 UTC

DO NOT REPLY [Bug 38249] New: - LoadFile task should support "quiet"

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

           Summary: LoadFile task should support "quiet"
           Product: Ant
           Version: 1.6.5
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: lizzardo@ix.netcom.com


It would be desirable if the LoadFile task supported the "quiet" attribute to
suppress the java.io.FileNotFoundException if the file does not exist.  

I have a case where it is not an error if the file doesn't exist, but the
exception still appears in the build report.  There are a several possible
workarounds to keep the report clean of false warnings, but it would be cleaner
if the task itself supported it.

-- 
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


DO NOT REPLY [Bug 38249] - LoadFile task should support "quiet"

Posted by bu...@apache.org.
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:36 -------
(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


DO NOT REPLY [Bug 38249] - LoadFile task should support "quiet"

Posted by bu...@apache.org.
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


peterreilly@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.7.0




------- Additional Comments From peterreilly@apache.org  2006-11-13 13:11 -------
Commited the patch.
Thanks for the report.


-- 
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


DO NOT REPLY [Bug 38249] - LoadFile task should support "quiet"

Posted by bu...@apache.org.
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


DO NOT REPLY [Bug 38249] - LoadFile task should support "quiet"

Posted by bu...@apache.org.
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 03:37 -------
Created an attachment (id=17405)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17405&action=view)
patch for LoadFile.java

I made the suggested enhancement locally.  The attached file is the output from
the following command:

  diff -u LoadFile.java.orig LoadFile.java > LoadFile.patch


-- 
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


DO NOT REPLY [Bug 38249] - LoadFile task should support "quiet"

Posted by bu...@apache.org.
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:45 -------
Created an attachment (id=17417)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17417&action=view)
patch of loadfile.html

This is a patch for the html doc file that goes with the modified patch to
LoadFile.java.	The modified patch is in the comment (sorry for the duplicate
commnet of that).  

The only difference in the modified patch of hte Java source is that it sets
failonerror to false when it sets quiet to true.  This made it more consistent
with other ant behavior.

The attached is the output from the following command:

diff -u loadfile.html.orig loadfile.html > loadfile.patch

-- 
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