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;
}