ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 3390] - depends list, trailing ","
Date Sun, 23 Sep 2001 03:20:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3390>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3390

depends list, trailing ","





------- Additional Comments From phanna@ipass.net  2001-09-22 20:20 -------
This is a fix for bug# 3390 (depends list, trailing ",").  It involves two
classes:

org.apache.tools.ant.Target
org.apache.tools.and.ProjectHelper

The fix itself is just a verification that tokens added to the dependency
list are not empty strings.  However, this logic exists in two places
(Target and ProjectHelper).  The patch refactors this and makes
Target.addDependency() private, so that modifications to the list all go
through Target.setDepends().

Here are the two diff files:

--- Target.java.save Mon Sep 03 21:48:24 2001
+++ Target.java Sat Sep 22 22:08:59 2001
@@ -85,7 +85,10 @@
             StringTokenizer tok =
                 new StringTokenizer(depS, ",", false);
             while (tok.hasMoreTokens()) {
-                addDependency(tok.nextToken().trim());
+                String token = tok.nextToken().trim();
+                if (!token.equals("")) {
+                    addDependency(token);
+                }
             }
         }
     }
@@ -126,7 +129,7 @@
         return retval;
     }

-    public void addDependency(String dependency) {
+    private void addDependency(String dependency) {
         dependencies.addElement(dependency);
     }


--- ProjectHelper.java.save Mon Sep 03 21:48:24 2001
+++ ProjectHelper.java Sat Sep 22 22:07:29 2001
@@ -421,11 +421,7 @@
             // take care of dependencies

             if (depends.length() > 0) {
-                StringTokenizer tok =
-                    new StringTokenizer(depends, ",", false);
-                while (tok.hasMoreTokens()) {
-                    target.addDependency(tok.nextToken().trim());
-                }
+                target.setDepends(depends);
             }
         }

Mime
View raw message