Hi all,

I have removed the hashmap and made sure that its properly backwards compatible.

Did not realise I had not tested the <filter token="blah" value="blah"/> 
properly.

Should be ant 1.x compatible now.

I am planning to update the docs but am working 16x7 at the moment so dont have 
much spare 
time. Should ease next week.

p.s. Have also done a little patch for handling of REM comment in sql.

Michael

? src/main/org/apache/tools/ant/types/FilterSet.java
Index: src/main/org/apache/tools//ant/IntrospectionHelper.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
retrieving revision 1.13
diff -c -r1.13 IntrospectionHelper.java
*** src/main/org/apache/tools//ant/IntrospectionHelper.java     2001/01/20 
13:41:56     1.13
--- src/main/org/apache/tools//ant/IntrospectionHelper.java     2001/03/26 
21:08:49
***************
*** 227,233 ****
              as.set(p, element, value);
          } catch (IllegalAccessException ie) {
              // impossible as getMethods should only return public methods
!             throw new BuildException(ie);
          } catch (InvocationTargetException ite) {
              Throwable t = ite.getTargetException();
              if (t instanceof BuildException) {
--- 227,235 ----
              as.set(p, element, value);
          } catch (IllegalAccessException ie) {
              // impossible as getMethods should only return public methods
!             throw new BuildException( "Impossible as getMethods should only 
return public methods " + 
!                     attributeName + 
!                     ": Actuall does happen if you have a public method on a 
private inner class", ie );
          } catch (InvocationTargetException ite) {
              Throwable t = ite.getTargetException();
              if (t instanceof BuildException) {
Index: src/main/org/apache/tools//ant/Project.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.56
diff -c -r1.56 Project.java
*** src/main/org/apache/tools//ant/Project.java 2001/03/19 13:05:45     1.56
--- src/main/org/apache/tools//ant/Project.java 2001/03/26 21:08:49
***************
*** 54,59 ****
--- 54,61 ----
  
  package org.apache.tools.ant;
  
+ import org.apache.tools.ant.types.FilterSet;
+ 
  import java.io.*;
  import java.util.*;
  import java.text.*;
***************
*** 68,73 ****
--- 70,76 ----
   * file paths at runtime as well as defining various project properties.
   *
   * @author [EMAIL PROTECTED]
+  * @author    <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  
  public class Project {
***************
*** 90,98 ****
      public static final String JAVA_1_2 = "1.2";
      public static final String JAVA_1_3 = "1.3";
  
-     public static final String TOKEN_START = "@";
-     public static final String TOKEN_END = "@";
- 
      private String name;
  
      private Hashtable properties = new Hashtable();
--- 93,98 ----
***************
*** 102,108 ****
      private Hashtable dataClassDefinitions = new Hashtable();
      private Hashtable taskClassDefinitions = new Hashtable();
      private Hashtable targets = new Hashtable();
!     private Hashtable filters = new Hashtable();
      private File baseDir;
  
      private Vector listeners = new Vector();
--- 102,108 ----
      private Hashtable dataClassDefinitions = new Hashtable();
      private Hashtable taskClassDefinitions = new Hashtable();
      private Hashtable targets = new Hashtable();
!     private FilterSet globalFilterSet = null;
      private File baseDir;
  
      private Vector listeners = new Vector();
***************
*** 295,310 ****
      public String getName() {
          return name;
      }
- 
-     public void addFilter(String token, String value) {
-         if (token == null) return;
-         log("Setting token to filter: " + token + " -> "
-             + value, MSG_DEBUG);
-         this.filters.put(token, value);
-     }
  
!     public Hashtable getFilters() {
!         return filters;
      }
  
      // match basedir attribute in xml
--- 295,307 ----
      public String getName() {
          return name;
      }
  
!     public FilterSet getFilterSet( Task task) {
!         log("Filter task DEPRECATED user filterset", MSG_DEBUG);
!         if( globalFilterSet == null ) {
!           globalFilterSet = new FilterSet( task );
!         }
!         return globalFilterSet;
      }
  
      // match basedir attribute in xml
***************
*** 694,703 ****
       *
       * @throws IOException 
       */
!     public void copyFile(String sourceFile, String destFile, boolean 
filtering,
                           boolean overwrite, boolean preserveLastModified)
          throws IOException {
!         copyFile(new File(sourceFile), new File(destFile), filtering, 
                   overwrite, preserveLastModified);
      }
  
--- 691,700 ----
       *
       * @throws IOException 
       */
!     public void copyFile(String sourceFile, String destFile, FilterSet 
filterSet, boolean filtering,
                           boolean overwrite, boolean preserveLastModified)
          throws IOException {
!         copyFile(new File(sourceFile), new File(destFile), filterSet, 
filtering, 
                   overwrite, preserveLastModified);
      }
  
***************
*** 731,737 ****
       */
      public void copyFile(File sourceFile, File destFile, boolean filtering,
                           boolean overwrite) throws IOException {
!         copyFile(sourceFile, destFile, filtering, overwrite, false);
      }
  
      /**
--- 728,734 ----
       */
      public void copyFile(File sourceFile, File destFile, boolean filtering,
                           boolean overwrite) throws IOException {
!         copyFile(sourceFile, destFile, null, filtering, overwrite, false);
      }
  
      /**
***************
*** 743,749 ****
       *
       * @throws IOException 
       */
!     public void copyFile(File sourceFile, File destFile, boolean filtering,
                           boolean overwrite, boolean preserveLastModified)
          throws IOException {
          
--- 740,746 ----
       *
       * @throws IOException 
       */
!     public void copyFile(File sourceFile, File destFile, FilterSet filterSet, 
boolean filtering,
                           boolean overwrite, boolean preserveLastModified)
          throws IOException {
          
***************
*** 759,765 ****
                  parent.mkdirs();
              }
  
!             if (filtering) {
                  BufferedReader in = new BufferedReader(new 
FileReader(sourceFile));
                  BufferedWriter out = new BufferedWriter(new 
FileWriter(destFile));
  
--- 756,767 ----
                  parent.mkdirs();
              }
  
!             // this should be removed along with globalFilter set when 
deprecation is final.
!             if( filtering ) {
!               filterSet = globalFilterSet;
!             }
!             
!             if ( filterSet != null && filterSet.hasFilters() ) {
                  BufferedReader in = new BufferedReader(new 
FileReader(sourceFile));
                  BufferedWriter out = new BufferedWriter(new 
FileWriter(destFile));
  
***************
*** 770,776 ****
                      if (line.length() == 0) {
                          out.newLine();
                      } else {
!                         newline = replace(line, filters);
                          out.write(newline);
                          out.newLine();
                      }
--- 772,778 ----
                      if (line.length() == 0) {
                          out.newLine();
                      } else {
!                         newline = filterSet.replaceTokens( line );
                          out.write(newline);
                          out.newLine();
                      }
***************
*** 839,889 ****
          } catch (Throwable other) {
              throw new BuildException("Exception setting the modification time 
"
                                       + "of " + file, other);
-         }
-     }
- 
-     /**
-      * Does replacement on the given string using the given token table.
-      *
-      * @returns the string with the token replaced.
-      */
-     private String replace(String s, Hashtable tokens) {
-         int index = s.indexOf(TOKEN_START);
- 
-         if (index > -1) {
-             try {
-                 StringBuffer b = new StringBuffer();
-                 int i = 0;
-                 String token = null;
-                 String value = null;
- 
-                 do {
-                     int endIndex = s.indexOf(TOKEN_END, 
-                                              index + TOKEN_START.length() + 
1);
-                     if (endIndex == -1) {
-                         break;
-                     }
-                     token = s.substring(index + TOKEN_START.length(), 
endIndex);
-                     b.append(s.substring(i, index));
-                     if (tokens.containsKey(token)) {
-                         value = (String) tokens.get(token);
-                         log("Replacing: " + TOKEN_START + token + TOKEN_END + 
" -> " + value, MSG_VERBOSE);
-                         b.append(value);
-                         i = index + TOKEN_START.length() + token.length() + 
TOKEN_END.length();
-                     } else {
-                         // just append TOKEN_START and search further
-                         b.append(TOKEN_START);
-                         i = index + TOKEN_START.length();
-                     }
-                 } while ((index = s.indexOf(TOKEN_START, i)) > -1);
- 
-                 b.append(s.substring(i));
-                 return b.toString();
-             } catch (StringIndexOutOfBoundsException e) {
-                 return s;
-             }
-         } else {
-             return s;
          }
      }
  
--- 841,846 ----
Index: src/main/org/apache/tools//ant/taskdefs/Copy.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
retrieving revision 1.14
diff -c -r1.14 Copy.java
*** src/main/org/apache/tools//ant/taskdefs/Copy.java   2001/01/22 21:15:09     
1.14
--- src/main/org/apache/tools//ant/taskdefs/Copy.java   2001/03/26 21:08:49
***************
*** 73,78 ****
--- 73,79 ----
   *
   * @author Glenn McAllister <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
+  * @author    <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public class Copy extends Task {
      protected File file = null;     // the source file 
***************
*** 91,96 ****
--- 92,98 ----
      protected Hashtable dirCopyMap = new Hashtable();
  
      protected Mapper mapperElement = null;
+     protected FilterSet filterSet = null;
  
      /**
       * Sets a single source file to copy.
***************
*** 124,133 ****
--- 126,153 ----
       * Sets filtering.
       */
      public void setFiltering(boolean filtering) {
+         log( "*** DEPRECATED use filtersets instead", Project.MSG_ERR ); 
          this.filtering = filtering;
      }
  
      /**
+      * Maybe creates a nested classpath element.
+      */
+     public FilterSet createFilterset() {
+         if (filterSet == null) {
+           filterSet = new FilterSet( this );
+         }
+         return filterSet;
+     }
+     
+     /**
+      * Set the a filter
+      */
+     public FilterSet getFilterSet() {
+       return filterSet;
+     }
+     
+     /**
       * Overwrite any existing destination file(s).
       */
      public void setOverwrite(boolean overwrite) {
***************
*** 333,340 ****
                      log("Copying " + fromFile + " to " + toFile, verbosity);
                      
                      project.copyFile(fromFile, 
!                                      toFile, 
!                                      filtering, 
                                       forceOverwrite,
                                       preserveLastModified);
                  } catch (IOException ioe) {
--- 353,361 ----
                      log("Copying " + fromFile + " to " + toFile, verbosity);
                      
                      project.copyFile(fromFile, 
!                                      toFile,
!                                      filterSet,
!                                      filtering,
                                       forceOverwrite,
                                       preserveLastModified);
                  } catch (IOException ioe) {
Index: src/main/org/apache/tools//ant/taskdefs/Exit.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exit.java,v
retrieving revision 1.2
diff -c -r1.2 Exit.java
*** src/main/org/apache/tools//ant/taskdefs/Exit.java   2001/01/03 14:18:30     
1.2
--- src/main/org/apache/tools//ant/taskdefs/Exit.java   2001/03/26 21:08:49
***************
*** 55,79 ****
  package org.apache.tools.ant.taskdefs;
  
  import org.apache.tools.ant.*;
  
  /**
   * Just exit the active build, giving an additional message 
   * if available.
   *
   * @author Nico Seessle <[EMAIL PROTECTED]>
   */
  public class Exit extends Task { 
!     private String message;
      
!     public void setMessage(String value) { 
!         this.message = value;
      }
!     
      public void execute() throws BuildException {
!         if (message != null && message.length() > 0) { 
!             throw new BuildException(message);
!         } else {
!             throw new BuildException("No message");
          }
      }
  }
--- 55,138 ----
  package org.apache.tools.ant.taskdefs;
  
  import org.apache.tools.ant.*;
+ import java.util.Enumeration;
+ import java.util.Hashtable;
  
  /**
   * Just exit the active build, giving an additional message 
   * if available.
+  * 
+  * Can supply conditional properties.
+  * With an <Strong>if</Strong> the task will exit if the property is set.
+  * With an <Strong>unless</Strong> the task will exit if the property is not 
set.
   *
   * @author Nico Seessle <[EMAIL PROTECTED]>
+  * @author <A href="mailto:[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public class Exit extends Task { 
! 
!     /** The message to display. */
!     private String message_;
! 
!     /** The if value. Will exit if this value is set. */
!     private String ifProperty_;
! 
!     /** The unless value. Will exit if this value is not set. */
!     private String unlessProperty_;
      
!     /** Test to see if the given property is set.
!     * Returns true if we should exit. That is when there is an if condition 
and the property is set.
!     * @param property The property to test.
!     * @return true if we should fail of false if we should continue. */
!     private boolean testIfProperty( String property ) {
!       // if its not set return true as we dont know if we should continue.
!       if ( property == null || property.length() == 0 ) {
!         return true;
!       }
!       return project.getProperty( property ) != null;
      }
! 
!     /** Test to see if the given property is set.
!     * Returns true if we should exit. That is when there is an unless 
condition and the property is not set.
!     * @param property The property to test. 
!     * @return true if we should fail of false if we should continue. */
!     private boolean testUnlessProperty( String property ) {
!       // if its not set return true as we dont know if we should continue.
!       if ( property == null || property.length() == 0 ) {
!         return true;
!       }
!       return project.getProperty( property ) == null;
!     }
! 
!     /** Set the message to display when executed. */
!     public void setMessage( String value ) { 
!       this.message_ = value;
!     }
! 
!     /** Set the if property. Will exit if this value is set.
!     * @param value The if value for conditional exiting. */
!     public void setIf( String value ) {
!       this.ifProperty_ = value;
!     }
! 
!     /** Set the unless property. Will exit if this value is not set.
!     * @param value The unless value for conditional exiting. */
!     public void setUnless( String value ) { 
!       this.unlessProperty_ = value;
!     }
! 
!     /** Execute this task. This will exit and print a message if the 
following conditions are met...
!     * if value is set.
!     * unless value is not set. */
      public void execute() throws BuildException {
!       if ( testUnlessProperty( unlessProperty_ ) && testIfProperty( 
ifProperty_ ) ) {
!         if ( message_ != null && message_.length() > 0 ) { 
!           throw new BuildException(message_);
!         } 
!         else {
!           throw new BuildException("No message");
          }
+       }
      }
+ 
  }
Index: src/main/org/apache/tools//ant/taskdefs/Filter.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Filter.java,v
retrieving revision 1.8
diff -c -r1.8 Filter.java
*** src/main/org/apache/tools//ant/taskdefs/Filter.java 2001/01/03 14:18:30     
1.8
--- src/main/org/apache/tools//ant/taskdefs/Filter.java 2001/03/26 21:08:49
***************
*** 9,36 ****
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
!  *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
!  *    notice, this list of conditions and the following disclaimer in
!  *    the documentation and/or other materials provided with the
!  *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
!  *    any, must include the following acknowlegement:
!  *       "This product includes software developed by the
!  *        Apache Software Foundation (http://www.apache.org/)."
!  *    Alternately, this acknowlegement may appear in the software itself,
!  *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
!  *    Foundation" must not be used to endorse or promote products derived
!  *    from this software without prior written permission. For written
!  *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
!  *    nor may "Apache" appear in their names without prior written
!  *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- 9,36 ----
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
!  * notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
!  * notice, this list of conditions and the following disclaimer in
!  * the documentation and/or other materials provided with the
!  * distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
!  * any, must include the following acknowlegement:
!  * "This product includes software developed by the
!  * Apache Software Foundation (http://www.apache.org/)."
!  * Alternately, this acknowlegement may appear in the software itself,
!  * if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
!  * Foundation" must not be used to endorse or promote products derived
!  * from this software without prior written permission. For written
!  * permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
!  * nor may "Apache" appear in their names without prior written
!  * permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
***************
*** 54,133 ****
  
  package org.apache.tools.ant.taskdefs;
  
! import java.util.Enumeration;
! import java.util.Properties;
  import java.io.File;
  import java.io.FileInputStream;
  
! import org.apache.tools.ant.*;
  
  /**
!  * This task sets a token filter that is used by the file copy methods
!  * of the project to do token substitution, or sets mutiple tokens by
!  * reading these from a file.
!  *
!  * @author Stefano Mazzocchi <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
!  * @author Gero Vermaas <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   */
  public class Filter extends Task {
  
!     private String token;
!     private String value;
!     private File filtersFile;
!     
!     public void setToken(String token) {
!         this.token = token;
!     }
  
!     public void setValue(String value) {
!         this.value = value;
      }
  
!     public void setFiltersfile(File filtersFile) {
!         this.filtersFile = filtersFile;
      }
  
!     public void execute() throws BuildException {
!         boolean isFiltersFromFile = filtersFile != null && token == null && 
value == null;
!         boolean isSingleFilter = filtersFile == null && token != null && 
value != null;
!         
!         if (!isFiltersFromFile && !isSingleFilter) {
!             throw new BuildException("both token and value parameters, or 
only a filtersFile parameter is required", location);
!         }
!         
!         if (isSingleFilter) {
!             project.addFilter(token, value);
!         }
!         
!         if (isFiltersFromFile) {
!             readFilters();
!         }
!     }
!     
!     protected void readFilters() throws BuildException {
!         log("Reading filters from " + filtersFile, Project.MSG_VERBOSE);
!         FileInputStream in = null;
!         try {
!             Properties props = new Properties();
!             in = new FileInputStream(filtersFile);
!             props.load(in);
! 
!             Project proj = getProject();
! 
!             Enumeration enum = props.propertyNames();
!             while (enum.hasMoreElements()) {
!                 String strPropName = (String)enum.nextElement();
!                 String strValue = props.getProperty(strPropName);
!                 proj.addFilter(strPropName, strValue);
!             }
!         } catch (Exception e) {
!             throw new BuildException("Could not read filters from file: " + 
filtersFile);
!         } finally {
!             if (in != null) {
!                 try {
!                     in.close();
!                 } catch (java.io.IOException ioex) {}
!             }
!         }
      }
  }
--- 54,139 ----
  
  package org.apache.tools.ant.taskdefs;
  
! // java io
  import java.io.File;
  import java.io.FileInputStream;
+ 
+ // java util
+ import java.util.Enumeration;
+ import java.util.Properties;
+ 
+ // ant core
+ import org.apache.tools.ant.BuildException;
+ import org.apache.tools.ant.Task;
  
! // ant types
! import org.apache.tools.ant.types.FilterSet;
  
  /**
!  * This task sets a token filter that is used by the file copy methods of the
!  * project to do token substitution, or sets mutiple tokens by reading these
!  * from a file.
!  *
!  * @author    Stefano Mazzocchi <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
!  * @author    Gero Vermaas <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
!  * @author    <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public class Filter extends Task {
  
!   private String token;
!   private String value;
!   private File filtersFile;
! 
!   /**
!    * Sets the Token attribute of the Filter object
!    *
!    * @param token  The new Token value
!    */
!   public void setToken( String token ) {
!     this.token = token;
!   }
! 
!   /**
!    * Sets the Value attribute of the Filter object
!    *
!    * @param value  The new Value value
!    */
!   public void setValue( String value ) {
!     this.value = value;
!   }
! 
!   /**
!    * Sets the Filtersfile attribute of the Filter object
!    *
!    * @param filtersFile  The new Filtersfile value
!    */
!   public void setFiltersfile( File filtersFile ) {
!     this.filtersFile = filtersFile;
!   }
! 
!   /**
!    * Description of the Method
!    *
!    * @exception BuildException  Description of Exception
!    */
!   public void execute()
!     throws BuildException {
!     boolean isFiltersFromFile = filtersFile != null && token == null && value 
== null;
!     boolean isSingleFilter = filtersFile == null && token != null && value != 
null;
  
!     if( !isFiltersFromFile && !isSingleFilter ) {
!       throw new BuildException( "both token and value parameters, or only a 
filtersFile parameter is required", location );
      }
  
!     FilterSet filterSet = project.getFilterSet( this );
!     if( isSingleFilter ) {
!       filterSet.addFilter( token, value );
      }
  
!     if( isFiltersFromFile ) {
!       filterSet.readFiltersFromFile( filtersFile );
      }
+   }
+ 
  }
+ 
Index: src/main/org/apache/tools//ant/taskdefs/Javac.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.64
diff -c -r1.64 Javac.java
*** src/main/org/apache/tools//ant/taskdefs/Javac.java  2001/01/12 14:08:50     
1.64
--- src/main/org/apache/tools//ant/taskdefs/Javac.java  2001/03/26 21:08:50
***************
*** 93,98 ****
--- 93,99 ----
   * @author Robin Green <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a> 
   * @author <a href="mailto:[EMAIL PROTECTED]">J D Glanville</a>
+  * @author    <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  
  public class Javac extends MatchingTask {
***************
*** 112,117 ****
--- 113,119 ----
      private String target;
      private Path bootclasspath;
      private Path extdirs;
+     private FilterSet filterSet;
      private boolean includeAntRuntime = true;
      private boolean includeJavaRuntime = false;
  
***************
*** 161,166 ****
--- 163,185 ----
       */
      public File getDestdir() {
          return destDir;
+     }
+     
+     /**
+      * Maybe creates a nested classpath element.
+      */
+     public FilterSet createFilterset() {
+         if (filterSet == null) {
+           filterSet = new FilterSet( this );
+         }
+         return filterSet;
+     }
+     
+     /**
+      * Set the a filter
+      */
+     public FilterSet getFilterSet() {
+       return filterSet;
      }
  
      /**
Index: src/main/org/apache/tools//ant/taskdefs/LogOutputStream.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java,v
retrieving revision 1.3
diff -c -r1.3 LogOutputStream.java
*** src/main/org/apache/tools//ant/taskdefs/LogOutputStream.java        
2001/01/03 14:18:30     1.3
--- src/main/org/apache/tools//ant/taskdefs/LogOutputStream.java        
2001/03/26 21:08:50
***************
*** 56,61 ****
--- 56,62 ----
  
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.Task;
+ import org.apache.tools.ant.types.FilterSet;
  
  import java.io.IOException;
  import java.io.OutputStream;
***************
*** 70,75 ****
--- 71,77 ----
   * of data written to the stream.
   *
   * @author [EMAIL PROTECTED]
+  * @author <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public class LogOutputStream extends OutputStream {
  
***************
*** 79,84 ****
--- 81,102 ----
      private Task task;
      private int level = Project.MSG_INFO;
  
+     /** The set of filters applied to the lines that are logged. */
+     private FilterSet filterSet_ = null;
+ 
+     /**
+      * Creates a new instance of this class with a set of filters.
+      *
+      * @param task the task for whom to log
+      * @param level loglevel used to log data written to this stream.
+      * @param filterSet The filterset to process the logged lines with.
+      */
+     public LogOutputStream(Task task, int level, FilterSet filterSet ) {
+         this.task = task;
+         this.level = level;
+         filterSet_ = filterSet;
+     }
+     
      /**
       * Creates a new instance of this class.
       *
***************
*** 90,96 ****
          this.level = level;
      }
  
- 
      /**
       * Write the data to the buffer and flush the buffer, if a line
       * separator is detected.
--- 108,113 ----
***************
*** 129,135 ****
       * @param line the line to log.
       */
      protected void processLine(String line, int level) {
!         task.log(line, level);
      }
  
  
--- 146,157 ----
       * @param line the line to log.
       */
      protected void processLine(String line, int level) {
!       if( filterSet_ == null ) {
!         task.log( line, level );
!       }
!       else {
!         task.log( filterSet_.processLineStart( line ), level);
!       }
      }
  
  
Index: src/main/org/apache/tools//ant/taskdefs/LogStreamHandler.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java,v
retrieving revision 1.2
diff -c -r1.2 LogStreamHandler.java
*** src/main/org/apache/tools//ant/taskdefs/LogStreamHandler.java       
2001/01/03 14:18:30     1.2
--- src/main/org/apache/tools//ant/taskdefs/LogStreamHandler.java       
2001/03/26 21:08:50
***************
*** 56,61 ****
--- 56,62 ----
  
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.Task;
+ import org.apache.tools.ant.types.FilterSet;
  
  import java.io.OutputStream;
  import java.io.InputStream;
***************
*** 64,69 ****
--- 65,71 ----
   * Logs standard output and error of a subprocess to the log system of ant.
   *
   * @author [EMAIL PROTECTED]
+  * @author <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public class LogStreamHandler extends PumpStreamHandler {
  
***************
*** 77,82 ****
--- 79,96 ----
      public LogStreamHandler(Task task, int outlevel, int errlevel) {
          super(new LogOutputStream(task, outlevel),
                new LogOutputStream(task, errlevel));
+     }
+ 
+     /**
+      * Creates a new instance of this class.
+      *
+      * @param task the task for whom to log
+      * @param outlevel the loglevel used to log standard output
+      * @param errlevel the loglevel used to log standard error
+      * @param filterSet A set of filters to be applied to all lines being 
logged on this stream.
+      */
+     public LogStreamHandler(Task task, int outlevel, int errlevel, FilterSet 
filterSet ) {
+         super( new LogOutputStream( task, outlevel, filterSet ), new 
LogOutputStream( task, errlevel, filterSet ) );
      }
  
  }
Index: src/main/org/apache/tools//ant/taskdefs/SQLExec.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.15
diff -c -r1.15 SQLExec.java
*** src/main/org/apache/tools//ant/taskdefs/SQLExec.java        2001/01/21 
00:41:25     1.15
--- src/main/org/apache/tools//ant/taskdefs/SQLExec.java        2001/03/26 
21:08:50
***************
*** 68,76 ****
  /**
   * Reads in a text file containing SQL statements seperated with semicolons
   * and executes it in a given db.
!  * Both -- and // maybe used as comments.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Martin</a>
   */
  public class SQLExec extends Task {
      
--- 68,77 ----
  /**
   * Reads in a text file containing SQL statements seperated with semicolons
   * and executes it in a given db.
!  * Comments may be created with REM -- or //.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Martin</a>
+  * @author <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public class SQLExec extends Task {
      
***************
*** 425,432 ****
   
          try{
              while ((line=in.readLine()) != null){
!                 if (line.trim().startsWith("//")) continue;
!                 if (line.trim().startsWith("--")) continue;
  
                  sql += " " + line;
                  sql = sql.trim();
--- 426,437 ----
   
          try{
              while ((line=in.readLine()) != null){
!                 line = line.trim();
!                 if (line.startsWith("//")) continue;
!                 if (line.startsWith("--")) continue;
!                 if ( line.length() > 2 ) {
!                   if (line.substring(0,3).equalsIgnoreCase("REM")) continue;
!                 }
  
                  sql += " " + line;
                  sql = sql.trim();
***************
*** 535,541 ****
          do {
              rs = statement.getResultSet();
              if (rs != null) {
!                       log("Processing new result set.", Project.MSG_VERBOSE);
                  ResultSetMetaData md = rs.getMetaData();
                  int columnCount = md.getColumnCount();
                  StringBuffer line = new StringBuffer();
--- 540,546 ----
          do {
              rs = statement.getResultSet();
              if (rs != null) {
!                 log("Processing new result set.", Project.MSG_VERBOSE);
                  ResultSetMetaData md = rs.getMetaData();
                  int columnCount = md.getColumnCount();
                  StringBuffer line = new StringBuffer();
Index: 
src/main/org/apache/tools//ant/taskdefs/compilers/DefaultCompilerAdapter.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
retrieving revision 1.3
diff -c -r1.3 DefaultCompilerAdapter.java
*** 
src/main/org/apache/tools//ant/taskdefs/compilers/DefaultCompilerAdapter.java   
    2001/03/09 16:07:56     1.3
--- 
src/main/org/apache/tools//ant/taskdefs/compilers/DefaultCompilerAdapter.java   
    2001/03/26 21:08:50
***************
*** 69,74 ****
--- 69,75 ----
   * @author Robin Green <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a> 
   * @author <a href="mailto:[EMAIL PROTECTED]">J D Glanville</a>
+  * @author <A href="[EMAIL PROTECTED]">Michael McCallum</A>
   */
  public abstract class DefaultCompilerAdapter implements CompilerAdapter {
  
***************
*** 93,98 ****
--- 94,102 ----
      protected boolean includeAntRuntime;
      protected boolean includeJavaRuntime;
  
+     /** Filters to be applied to the output of the compiler. */
+     protected FilterSet filterSet;
+ 
      protected File[] compileList;
      protected static String lSep = System.getProperty("line.separator");
      protected Javac attributes;
***************
*** 116,121 ****
--- 120,126 ----
          location = attributes.getLocation();
          includeAntRuntime = attributes.getIncludeantruntime();
          includeJavaRuntime = attributes.getIncludejavaruntime();
+         filterSet = attributes.getFilterSet();
      }
  
      public Javac getJavac() {
***************
*** 335,341 ****
              try {
                  Execute exe = new Execute(new LogStreamHandler(attributes, 
                                                                 
Project.MSG_INFO,
!                                                                
Project.MSG_WARN));
                  exe.setAntRun(project);
                  exe.setWorkingDirectory(project.getBaseDir());
                  exe.setCommandline(commandArray);
--- 340,347 ----
              try {
                  Execute exe = new Execute(new LogStreamHandler(attributes, 
                                                                 
Project.MSG_INFO,
!                                                                
Project.MSG_WARN,
!                                                                filterSet));
                  exe.setAntRun(project);
                  exe.setWorkingDirectory(project.getBaseDir());
                  exe.setCommandline(commandArray);
Index: src/main/org/apache/tools//ant/types/defaults.properties
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/defaults.properties,v
retrieving revision 1.2
diff -c -r1.2 defaults.properties
*** src/main/org/apache/tools//ant/types/defaults.properties    2000/11/17 
10:00:58     1.2
--- src/main/org/apache/tools//ant/types/defaults.properties    2001/03/26 
21:08:52
***************
*** 1,4 ****
! path=org.apache.tools.ant.types.Path
! fileset=org.apache.tools.ant.types.FileSet
! patternset=org.apache.tools.ant.types.PatternSet
! mapper=org.apache.tools.ant.types.Mapper
--- 1,5 ----
! path=org.apache.tools.ant.types.Path
! fileset=org.apache.tools.ant.types.FileSet
! patternset=org.apache.tools.ant.types.PatternSet
! mapper=org.apache.tools.ant.types.Mapper
! filterset=org.apache.tools.ant.types.FilterSet

Reply via email to