Browse Source

Fix for 39439: <fileset> in <cab> does not work.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@447991 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
267492df58
2 changed files with 16 additions and 11 deletions
  1. +2
    -0
      WHATSNEW
  2. +14
    -11
      src/main/org/apache/tools/ant/taskdefs/optional/Cab.java

+ 2
- 0
WHATSNEW View File

@@ -15,6 +15,8 @@ Fixed bugs:
* <path location="loc"> was broken (Regression from beta1).
Bugzilla report 40547.

* nested fileset in <cab> did not work. Bugzilla report 39439.

Other changes:
--------------



+ 14
- 11
src/main/org/apache/tools/ant/taskdefs/optional/Cab.java View File

@@ -95,6 +95,9 @@ public class Cab extends MatchingTask {
* 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 @@ public class Cab extends MatchingTask {
*/
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 @@ public class Cab extends MatchingTask {

/**
* 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 @@ public class Cab extends MatchingTask {
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;


Loading…
Cancel
Save