ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant Target.java
Date Sun, 30 Sep 2001 13:22:13 GMT
donaldp     01/09/30 06:22:13

  Modified:    src/main/org/apache/tools/ant Tag: ANT_14_BRANCH Target.java
  Log:
  Reworked dependency parser so that it can not have empty strings as dependency and nor can
it end in a , character.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.22.2.2  +21 -3     jakarta-ant/src/main/org/apache/tools/ant/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Target.java,v
  retrieving revision 1.22.2.1
  retrieving revision 1.22.2.2
  diff -u -r1.22.2.1 -r1.22.2.2
  --- Target.java	2001/09/27 11:27:24	1.22.2.1
  +++ Target.java	2001/09/30 13:22:13	1.22.2.2
  @@ -83,11 +83,29 @@
       public void setDepends(String depS) {
           if (depS.length() > 0) {
               StringTokenizer tok =
  -                new StringTokenizer(depS, ",", false);
  +                new StringTokenizer(depS, ",", true);
               while (tok.hasMoreTokens()) {
                   String token = tok.nextToken().trim();
  -                if (!token.equals("")) {
  -                    addDependency(token);
  +
  +                //Make sure the dependency is not empty string
  +                if (token.equals("")) {
  +                    throw new BuildException( "Syntax Error: Depend attribute " +
  +                                              "for target \"" + getName() + 
  +                                              "\" has an empty string for dependency."
);
  +                }
  +
  +                //Add dependency
  +                addDependency(token);
  +                
  +                //Make sure that depends attribute does not
  +                //end in a ,
  +                if (tok.hasMoreTokens()) {
  +                    tok.nextToken();
  +                    if (!tok.hasMoreTokens()) {
  +                        throw new BuildException( "Syntax Error: Depend attribute " +
  +                                                  "for target \"" + getName() + 
  +                                                  "\" ends with a , character" );
  +                    }
                   }
               }
           }
  
  
  

Mime
View raw message