You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/09/20 00:01:56 UTC

svn commit: r447991 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/Cab.java

Author: peterreilly
Date: Tue Sep 19 15:01:56 2006
New Revision: 447991

URL: http://svn.apache.org/viewvc?view=rev&rev=447991
Log:
Fix for 39439: <fileset> in <cab> does not work.


Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=447991&r1=447990&r2=447991
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Sep 19 15:01:56 2006
@@ -15,6 +15,8 @@
 * <path location="loc"> was broken (Regression from beta1).
   Bugzilla report 40547.
 
+* nested fileset in <cab> did not work. Bugzilla report 39439.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java?view=diff&rev=447991&r1=447990&r2=447991
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java Tue Sep 19 15:01:56 2006
@@ -95,6 +95,9 @@
      * Adds a set of files to archive.
      */
     public void addFileset(FileSet set) {
+        if (filesets.size() > 0) {
+            throw new BuildException("Only one nested fileset allowed");
+        }
         filesets.addElement(set);
     }
 
@@ -105,13 +108,17 @@
      */
     protected void checkConfiguration() throws BuildException {
         if (baseDir == null && filesets.size() == 0) {
-            throw new BuildException("basedir attribute or at least one "
-                                     + "nested filest is required!",
+            throw new BuildException("basedir attribute or one "
+                                     + "nested fileset is required!",
                                      getLocation());
         }
         if (baseDir != null && !baseDir.exists()) {
             throw new BuildException("basedir does not exist!", getLocation());
         }
+        if (baseDir != null && filesets.size() > 0) {
+            throw new BuildException(
+                "Both basedir attribute and a nested fileset is not allowed");
+        }
         if (cabFile == null) {
             throw new BuildException("cabfile attribute must be set!",
                                      getLocation());
@@ -179,7 +186,7 @@
 
     /**
      * Get the complete list of files to be included in the cab.  Filenames
-     * are gathered from filesets if any have been added, otherwise from the
+     * are gathered from the fileset if it has been added, otherwise from the
      * traditional include parameters.
      */
     protected Vector getFileList() throws BuildException {
@@ -188,14 +195,10 @@
         if (baseDir != null) {
             // get files from old methods - includes and nested include
             appendFiles(files, super.getDirectoryScanner(baseDir));
-        }
-
-        // get files from filesets
-        for (int i = 0; i < filesets.size(); i++) {
-            FileSet fs = (FileSet) filesets.elementAt(i);
-            if (fs != null) {
-                appendFiles(files, fs.getDirectoryScanner(getProject()));
-            }
+        } else {
+            FileSet fs = (FileSet) filesets.elementAt(0);
+            baseDir = fs.getDir();
+            appendFiles(files, fs.getDirectoryScanner(getProject()));
         }
 
         return files;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org