From 33c2653138032f6190b57e53e4e2512ee1938c55 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Wed, 4 Oct 2006 21:27:14 +0000 Subject: [PATCH] Bugzilla 30498: no check on refid for setting some attributes in zipfileset git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@453035 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ src/main/org/apache/tools/ant/types/ArchiveFileSet.java | 5 +++++ src/main/org/apache/tools/ant/types/ZipFileSet.java | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/WHATSNEW b/WHATSNEW index 4bc3ca058..2e6116c2a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -32,6 +32,9 @@ Fixed bugs: * UnknownElement.maybeConfigure always configured. Bugzilla report 40641. +* no check for refid when prefix attribute is set in zipfileset. + Bugzilla report 30498. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/types/ArchiveFileSet.java b/src/main/org/apache/tools/ant/types/ArchiveFileSet.java index 3eab55f5d..2c3b2a5bc 100755 --- a/src/main/org/apache/tools/ant/types/ArchiveFileSet.java +++ b/src/main/org/apache/tools/ant/types/ArchiveFileSet.java @@ -130,6 +130,7 @@ public abstract class ArchiveFileSet extends FileSet { * @param srcFile The archive from which to extract entries. */ public void setSrc(File srcFile) { + checkAttributesAllowed(); setSrcResource(new FileResource(srcFile)); } @@ -177,6 +178,7 @@ public abstract class ArchiveFileSet extends FileSet { * @param prefix The prefix to prepend to entries in the archive file. */ public void setPrefix(String prefix) { + checkAttributesAllowed(); if (!prefix.equals("") && !fullpath.equals("")) { throw new BuildException("Cannot set both fullpath and prefix attributes"); } @@ -202,6 +204,7 @@ public abstract class ArchiveFileSet extends FileSet { * @param fullpath the full pathname of the single entry in this fileset. */ public void setFullpath(String fullpath) { + checkAttributesAllowed(); if (!prefix.equals("") && !fullpath.equals("")) { throw new BuildException("Cannot set both fullpath and prefix attributes"); } @@ -304,6 +307,7 @@ public abstract class ArchiveFileSet extends FileSet { * @param octalString a String value */ public void setFileMode(String octalString) { + checkAttributesAllowed(); integerSetFileMode(Integer.parseInt(octalString, BASE_OCTAL)); } @@ -352,6 +356,7 @@ public abstract class ArchiveFileSet extends FileSet { * @param octalString a String value */ public void setDirMode(String octalString) { + checkAttributesAllowed(); integerSetDirMode(Integer.parseInt(octalString, BASE_OCTAL)); } diff --git a/src/main/org/apache/tools/ant/types/ZipFileSet.java b/src/main/org/apache/tools/ant/types/ZipFileSet.java index f8df21593..a8e0e79fb 100644 --- a/src/main/org/apache/tools/ant/types/ZipFileSet.java +++ b/src/main/org/apache/tools/ant/types/ZipFileSet.java @@ -63,6 +63,7 @@ public class ZipFileSet extends ArchiveFileSet { * @since Ant 1.7 */ public void setEncoding(String enc) { + checkAttributesAllowed(); this.encoding = enc; } @@ -72,6 +73,14 @@ public class ZipFileSet extends ArchiveFileSet { * @since Ant 1.7 */ public String getEncoding() { + if (isReference()) { + AbstractFileSet ref = getRef(getProject()); + if (ref instanceof ZipFileSet) { + return ((ZipFileSet) ref).getEncoding(); + } else { + return null; + } + } return encoding; }