bodewig 01/01/08 08:45:33
Modified: src/main/org/apache/tools/ant/taskdefs Jar.java War.java
Zip.java
Log:
Resolve confusion between <fileset> and <prefixedfileset> in <zip> and
friends.
Revision Changes Path
1.14 +1 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jar.java
Index: Jar.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jar.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Jar.java 2001/01/04 12:37:20 1.13
+++ Jar.java 2001/01/08 16:45:32 1.14
@@ -90,7 +90,7 @@
fs.setDir(new File(manifest.getParent()));
fs.setIncludes(manifest.getName());
fs.setFullpath("META-INF/MANIFEST.MF");
- super.addFileset(fs);
+ super.addPrefixedfileset(fs);
}
1.9 +4 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/War.java
Index: War.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/War.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- War.java 2001/01/04 12:37:20 1.8
+++ War.java 2001/01/08 16:45:32 1.9
@@ -91,25 +91,25 @@
fs.setDir(new File(deploymentDescriptor.getParent()));
fs.setIncludes(deploymentDescriptor.getName());
fs.setFullpath("WEB-INF/web.xml");
- super.addFileset(fs);
+ super.addPrefixedfileset(fs);
}
public void addLib(PrefixedFileSet fs) {
// We just set the prefix for this fileset, and pass it up.
fs.setPrefix("WEB-INF/lib/");
- super.addFileset(fs);
+ super.addPrefixedfileset(fs);
}
public void addClasses(PrefixedFileSet fs) {
// We just set the prefix for this fileset, and pass it up.
fs.setPrefix("WEB-INF/classes/");
- super.addFileset(fs);
+ super.addPrefixedfileset(fs);
}
public void addWebinf(PrefixedFileSet fs) {
// We just set the prefix for this fileset, and pass it up.
fs.setPrefix("WEB-INF/");
- super.addFileset(fs);
+ super.addPrefixedfileset(fs);
}
protected void initZipOutputStream(ZipOutputStream zOut)
1.26 +12 -6
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Zip.java 2001/01/04 12:37:20 1.25
+++ Zip.java 2001/01/08 16:45:32 1.26
@@ -109,7 +109,7 @@
/**
* Adds a set of files (nested fileset attribute).
*/
- public void addFileset(PrefixedFileSet set) {
+ public void addFileset(FileSet set) {
filesets.addElement(set);
}
@@ -499,22 +499,28 @@
}
/**
- * Iterate over the given Vector of prefixedfilesets and add
+ * Iterate over the given Vector of (prefixed)filesets and add
* all files to the ZipOutputStream using the given prefix.
*/
protected void addFiles(Vector filesets, ZipOutputStream zOut)
throws IOException {
// Add each fileset in the Vector.
for (int i = 0; i<filesets.size(); i++) {
- PrefixedFileSet fs = (PrefixedFileSet) filesets.elementAt(i);
+ FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
- String prefix = fs.getPrefix();
+ String prefix = "";
+ String fullpath = "";
+ if (fs instanceof PrefixedFileSet) {
+ PrefixedFileSet pfs = (PrefixedFileSet) fs;
+ prefix = pfs.getPrefix();
+ fullpath = pfs.getFullpath();
+ }
+
if (prefix.length() > 0
&& !prefix.endsWith("/")
&& !prefix.endsWith("\\")) {
prefix += "/";
}
- String fullpath = fs.getFullpath();
// Need to manually add either fullpath's parent directory, or
// the prefix directory, to the archive.
if (prefix.length() > 0) {
@@ -522,7 +528,7 @@
zipDir(null, zOut, prefix);
} else if (fullpath.length() > 0) {
addParentDirs(null, fullpath, zOut, "");
- }
+ }
// Add the fileset.
addFiles(ds, zOut, prefix, fullpath);
}