bodewig 2003/10/10 03:39:09
Modified: src/main/org/apache/tools/ant/types ZipFileSet.java
Log:
Fix PR 23639
Revision Changes Path
1.23 +10 -15 ant/src/main/org/apache/tools/ant/types/ZipFileSet.java
Index: ZipFileSet.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/ZipFileSet.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ZipFileSet.java 15 Jul 2003 14:54:14 -0000 1.22
+++ ZipFileSet.java 10 Oct 2003 10:39:08 -0000 1.23
@@ -172,10 +172,7 @@
* @param prefix The prefix to prepend to entries in the zip file.
*/
public void setPrefix(String prefix) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (!fullpath.equals("")) {
+ if (!prefix.equals("") && !fullpath.equals("")) {
throw new BuildException("Cannot set both fullpath and prefix
attributes");
}
this.prefix = prefix;
@@ -198,10 +195,7 @@
* @param fullpath the full pathname of the single entry in this fileset.
*/
public void setFullpath(String fullpath) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (!prefix.equals("")) {
+ if (!prefix.equals("") && !fullpath.equals("")) {
throw new BuildException("Cannot set both fullpath and prefix
attributes");
}
this.fullpath = fullpath;
@@ -246,9 +240,6 @@
* @since Ant 1.5.2
*/
public void setFileMode(String octalString) {
- if (isReference()) {
- throw tooManyAttributes();
- }
fileModeHasBeenSet = true;
this.fileMode =
UnixStat.FILE_FLAG | Integer.parseInt(octalString, 8);
@@ -284,9 +275,6 @@
* @since Ant 1.5.2
*/
public void setDirMode(String octalString) {
- if (isReference()) {
- throw tooManyAttributes();
- }
dirModeHasBeenSet = true;
this.dirMode =
UnixStat.DIR_FLAG | Integer.parseInt(octalString, 8);
@@ -328,7 +316,14 @@
if (o instanceof ZipFileSet) {
return (AbstractFileSet) o;
} else if (o instanceof FileSet) {
- return (new ZipFileSet((FileSet) o));
+ ZipFileSet zfs = new ZipFileSet((FileSet) o);
+ zfs.setPrefix(prefix);
+ zfs.setFullpath(fullpath);
+ zfs.fileModeHasBeenSet = fileModeHasBeenSet;
+ zfs.fileMode = fileMode;
+ zfs.dirModeHasBeenSet = dirModeHasBeenSet;
+ zfs.dirMode = dirMode;
+ return zfs;
} else {
String msg = getRefid().getRefId() + " doesn\'t denote a
zipfileset or a fileset";
throw new BuildException(msg);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]