Browse Source

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
master
Peter Reilly 18 years ago
parent
commit
33c2653138
3 changed files with 17 additions and 0 deletions
  1. +3
    -0
      WHATSNEW
  2. +5
    -0
      src/main/org/apache/tools/ant/types/ArchiveFileSet.java
  3. +9
    -0
      src/main/org/apache/tools/ant/types/ZipFileSet.java

+ 3
- 0
WHATSNEW View File

@@ -32,6 +32,9 @@ Fixed bugs:
* UnknownElement.maybeConfigure always configured. * UnknownElement.maybeConfigure always configured.
Bugzilla report 40641. Bugzilla report 40641.


* no check for refid when prefix attribute is set in zipfileset.
Bugzilla report 30498.

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




+ 5
- 0
src/main/org/apache/tools/ant/types/ArchiveFileSet.java View File

@@ -130,6 +130,7 @@ public abstract class ArchiveFileSet extends FileSet {
* @param srcFile The archive from which to extract entries. * @param srcFile The archive from which to extract entries.
*/ */
public void setSrc(File srcFile) { public void setSrc(File srcFile) {
checkAttributesAllowed();
setSrcResource(new FileResource(srcFile)); 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. * @param prefix The prefix to prepend to entries in the archive file.
*/ */
public void setPrefix(String prefix) { public void setPrefix(String prefix) {
checkAttributesAllowed();
if (!prefix.equals("") && !fullpath.equals("")) { if (!prefix.equals("") && !fullpath.equals("")) {
throw new BuildException("Cannot set both fullpath and prefix attributes"); 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. * @param fullpath the full pathname of the single entry in this fileset.
*/ */
public void setFullpath(String fullpath) { public void setFullpath(String fullpath) {
checkAttributesAllowed();
if (!prefix.equals("") && !fullpath.equals("")) { if (!prefix.equals("") && !fullpath.equals("")) {
throw new BuildException("Cannot set both fullpath and prefix attributes"); throw new BuildException("Cannot set both fullpath and prefix attributes");
} }
@@ -304,6 +307,7 @@ public abstract class ArchiveFileSet extends FileSet {
* @param octalString a <code>String</code> value * @param octalString a <code>String</code> value
*/ */
public void setFileMode(String octalString) { public void setFileMode(String octalString) {
checkAttributesAllowed();
integerSetFileMode(Integer.parseInt(octalString, BASE_OCTAL)); integerSetFileMode(Integer.parseInt(octalString, BASE_OCTAL));
} }


@@ -352,6 +356,7 @@ public abstract class ArchiveFileSet extends FileSet {
* @param octalString a <code>String</code> value * @param octalString a <code>String</code> value
*/ */
public void setDirMode(String octalString) { public void setDirMode(String octalString) {
checkAttributesAllowed();
integerSetDirMode(Integer.parseInt(octalString, BASE_OCTAL)); integerSetDirMode(Integer.parseInt(octalString, BASE_OCTAL));
} }




+ 9
- 0
src/main/org/apache/tools/ant/types/ZipFileSet.java View File

@@ -63,6 +63,7 @@ public class ZipFileSet extends ArchiveFileSet {
* @since Ant 1.7 * @since Ant 1.7
*/ */
public void setEncoding(String enc) { public void setEncoding(String enc) {
checkAttributesAllowed();
this.encoding = enc; this.encoding = enc;
} }


@@ -72,6 +73,14 @@ public class ZipFileSet extends ArchiveFileSet {
* @since Ant 1.7 * @since Ant 1.7
*/ */
public String getEncoding() { public String getEncoding() {
if (isReference()) {
AbstractFileSet ref = getRef(getProject());
if (ref instanceof ZipFileSet) {
return ((ZipFileSet) ref).getEncoding();
} else {
return null;
}
}
return encoding; return encoding;
} }




Loading…
Cancel
Save