You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ra...@scenespot.org on 2001/07/30 19:08:42 UTC

[PATCH] alter filter task to catch an exception on file not found

I'm not sure if this was intended or not, but the Filter
task behaves differently than properties when attempting to
load an external file as a filter.  Property continues on
but filter dies with a FileNotFoundException.  This tiny
patch from Larry at OpenNMS changes the behaviour to match
the property task.
 
I'm not a Java coder, just a build manager, but I thought
I'd pass it on and see if you guys wanted it or not.  If not,
I'll continue overriding it in our own build.  =)
 
--- src/main/org/apache/tools/ant/taskdefs/Filter.java  Wed Jan  3 09:18:30 2001
+++ ../opennms/tools/ant/org/apache/tools/ant/taskdefs/Filter.java      Sun Jul 15 13:08:51 2001
@@ -58,6 +58,7 @@
 import java.util.Properties;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 
 import org.apache.tools.ant.*;
 
@@ -120,6 +121,8 @@
                 String strValue = props.getProperty(strPropName);
                 proj.addFilter(strPropName, strValue);
             }
+        } catch (FileNotFoundException e) {
+            this.log("Warning: "+filtersFile+" not found.");
         } catch (Exception e) {
             throw new BuildException("Could not read filters from file: " + filtersFile);
         } finally {
 
--
Ben Reed a.k.a. Ranger Rick (ranger@befunk.com)
http://defiance.dyndns.org/ / http://radio.scenespot.org/
The devil's in the broad, sweeping generalizations.