cvs commit: ant/src/main/org/apache/tools/ant/filters TokenFilter.java

2003-08-13 Thread peterreilly
peterreilly2003/08/13 06:44:26

  Modified:src/main/org/apache/tools/ant UnknownElement.java
   src/main/org/apache/tools/ant/filters TokenFilter.java
  Log:
  Two of the files in 22326
  PR: 22326
  Obtained from: Martijn Kruithof
  
  Revision  ChangesPath
  1.61  +1 -1  ant/src/main/org/apache/tools/ant/UnknownElement.java
  
  Index: UnknownElement.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/UnknownElement.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- UnknownElement.java   13 Aug 2003 13:18:54 -  1.60
  +++ UnknownElement.java   13 Aug 2003 13:44:26 -  1.61
  @@ -159,7 +159,7 @@
* @return the configuration info.
*/
   public RuntimeConfigurable getWrapper() {
  -return wrapper;
  +return super.getWrapper();
   }
   
   /**
  
  
  
  1.11  +1 -1  
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
  
  Index: TokenFilter.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TokenFilter.java  23 Jul 2003 11:32:12 -  1.10
  +++ TokenFilter.java  13 Aug 2003 13:44:26 -  1.11
  @@ -654,7 +654,7 @@
   }
   regularExpression = new RegularExpression();
   regularExpression.setPattern(from);
  -regexp = regularExpression.getRegexp(project);
  +regexp = regularExpression.getRegexp(getProject());
   if (to == null) {
   to = "";
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/filters TokenFilter.java

2003-07-04 Thread peterreilly
peterreilly2003/07/04 09:16:51

  Modified:src/main/org/apache/tools/ant/filters TokenFilter.java
  Log:
  Fix echeckstyle reported issues
  
  Revision  ChangesPath
  1.8   +281 -154  
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
  
  Index: TokenFilter.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TokenFilter.java  4 Jul 2003 14:04:53 -   1.7
  +++ TokenFilter.java  4 Jul 2003 16:16:50 -   1.8
  @@ -75,10 +75,8 @@
* @see ChainableReader
* @see DynamicConfigurator
*/
  -public class TokenFilter
  -extends BaseFilterReader
  -implements ChainableReader
  -{
  +public class TokenFilter extends BaseFilterReader
  +implements ChainableReader {
   /**
* input stream tokenizers implement this interface
*/
  @@ -88,15 +86,17 @@
* @param in the input stream
* @return the next token, or null for the end
* of the stream
  + * @throws IOException if an error occurs
*/
  -public String getToken(Reader in)
  +String getToken(Reader in)
   throws IOException;
  +
   /**
* return the string between tokens, after the
* previous token.
* @return the intra-token string
*/
  -public String getPostToken();
  +String getPostToken();
   }
   
   /**
  @@ -106,11 +106,11 @@
   /**
* filter and/of modify a string
*
  - * @param filter the string to filter
  + * @param string the string to filter
* @return the modified string or null if the
* string did not pass the filter
*/
  -public String filter(String string);
  +String filter(String string);
   }
   
   
  @@ -158,34 +158,37 @@
*/
   
   public int read() throws IOException {
  -if (tokenizer == null)
  +if (tokenizer == null) {
   tokenizer = new LineTokenizer();
  -
  +}
   while (line == null || line.length() == 0) {
   line = tokenizer.getToken(in);
  -if (line == null)
  +if (line == null) {
   return -1;
  -for (Enumeration e = filters.elements(); e.hasMoreElements();)
  -{
  +}
  +for (Enumeration e = filters.elements(); e.hasMoreElements();) {
   Filter filter = (Filter) e.nextElement();
   line = filter.filter(line);
  -if (line == null)
  +if (line == null) {
   break;
  +}
   }
   linePos = 0;
   if (line != null) {
   if (tokenizer.getPostToken().length() != 0) {
  -if (delimOutput != null)
  +if (delimOutput != null) {
   line = line + delimOutput;
  -else
  +} else {
   line = line + tokenizer.getPostToken();
  +}
   }
   }
   }
   int ch = line.charAt(linePos);
  -linePos ++;
  -if (linePos == line.length())
  +linePos++;
  +if (linePos == line.length()) {
   line = null;
  +}
   return ch;
   }
   
  @@ -223,6 +226,7 @@
   
   /**
* add a line tokenizer - this is the default.
  + * @param tokenizer the line tokenizer
*/
   
   public void addLineTokenizer(LineTokenizer tokenizer) {
  @@ -231,6 +235,7 @@
   
   /**
* add a string tokenizer
  + * @param tokenizer the string tokenizer
*/
   
   public void addStringTokenizer(StringTokenizer tokenizer) {
  @@ -238,19 +243,22 @@
   }
   
   /**
  - *  add a file tokenizer
  + * add a file tokenizer
  + * @param tokenizer the file tokenizer
*/
   public void addFileTokenizer(FileTokenizer tokenizer) {
   add(tokenizer);
   }
   
   /**
  - * add a tokenizer
  + * add an arbirarty tokenizer
  + * @param tokenizer the tokenizer to all, only one allowed
*/
   
   public void add(Tokenizer tokenizer) {
  -if (this.tokenizer != null)
  +if (this.tokenizer != null) {
   throw new BuildException("Only one tokenizer allowed");
  +}
   this.tokenizer = tokenizer;
   }
   
  @@ -258,41 +266,66 @@
   //  Predefined filters
   // -
   
  -/** replace string filter */
  +/**
  + * replace string filter
  + * @param filter the replace string filter
  + */
   public void addRe

cvs commit: ant/src/main/org/apache/tools/ant/filters TokenFilter.java

2003-06-26 Thread peterreilly
peterreilly2003/06/26 09:45:05

  Modified:src/main/org/apache/tools/ant/filters TokenFilter.java
  Log:
  opps - 2: set includedelims to the attribute in the C&P method
  
  Revision  ChangesPath
  1.6   +1 -1  
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
  
  Index: TokenFilter.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TokenFilter.java  26 Jun 2003 16:34:24 -  1.5
  +++ TokenFilter.java  26 Jun 2003 16:45:05 -  1.6
  @@ -469,7 +469,7 @@
* default - false
*/
   public void setIncludeDelims(boolean includeDelims) {
  -this.includeDelims = true;
  +this.includeDelims = includeDelims;
   }
   
   public String getToken(Reader in)
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/filters TokenFilter.java

2003-06-26 Thread peterreilly
peterreilly2003/06/26 09:34:26

  Modified:src/main/org/apache/tools/ant/filters TokenFilter.java
  Log:
  opps: set includedelims to the attribute
  
  Revision  ChangesPath
  1.5   +1 -1  
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
  
  Index: TokenFilter.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TokenFilter.java  28 May 2003 16:27:33 -  1.4
  +++ TokenFilter.java  26 Jun 2003 16:34:24 -  1.5
  @@ -355,7 +355,7 @@
*/
   
   public void setIncludeDelims(boolean includeDelims) {
  -this.includeDelims = true;
  +this.includeDelims = includeDelims;
   }
   
   public String getToken(Reader in)
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/filters TokenFilter.java

2003-04-24 Thread bodewig
bodewig 2003/04/24 02:37:48

  Modified:src/main/org/apache/tools/ant/filters TokenFilter.java
  Log:
  More code reuse
  
  Revision  ChangesPath
  1.3   +2 -11 
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
  
  Index: TokenFilter.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TokenFilter.java  22 Apr 2003 18:23:54 -  1.2
  +++ TokenFilter.java  24 Apr 2003 09:37:48 -  1.3
  @@ -65,6 +65,7 @@
   import org.apache.tools.ant.types.Parameter;
   import org.apache.tools.ant.types.RegularExpression;
   import org.apache.tools.ant.types.Substitution;
  +import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.util.regexp.Regexp;
   
   /**
  @@ -358,17 +359,7 @@
   public String getToken(Reader in)
   throws IOException
   {
  -StringBuffer output = new StringBuffer();
  -char[] buffer = new char[8192];
  -while (true) {
  -int nread = in.read(buffer, 0, 8192);
  -if (nread == -1)
  -break;
  -output.append(buffer, 0, nread);
  -}
  -if (output.length() == 0)
  -return null;
  -return output.toString();
  +return FileUtils.readFully(in);
   }
   
   /**