Browse Source

avoid backward compatibility problems for lib attribute of war task, so relax ZipFileSet#getRef

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274501 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
6d360a5aff
2 changed files with 12 additions and 11 deletions
  1. +1
    -1
      src/etc/testcases/taskdefs/war.xml
  2. +11
    -10
      src/main/org/apache/tools/ant/types/ZipFileSet.java

+ 1
- 1
src/etc/testcases/taskdefs/war.xml View File

@@ -12,7 +12,7 @@
</target>
<target name="testlibrefs" depends="setup">
<zipfileset id="test" dir="." includes="foobar"/>
<fileset id="test" dir="." includes="foobar"/>
<war webxml="war.xml" destfile="${working.dir}/test.war">
<lib refid="test"/>
</war>


+ 11
- 10
src/main/org/apache/tools/ant/types/ZipFileSet.java View File

@@ -234,8 +234,8 @@ public class ZipFileSet extends FileSet {
}

/**
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* optional, default=0644
*
* @since Ant 1.5.2
@@ -247,7 +247,7 @@ public class ZipFileSet extends FileSet {
this.fileMode =
UnixStat.FILE_FLAG | Integer.parseInt(octalString, 8);
}
/**
* @since Ant 1.5.2
*/
@@ -257,10 +257,10 @@ public class ZipFileSet extends FileSet {
}
return fileMode;
}
/**
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* optional, default=0755
*
* @since Ant 1.6
@@ -272,7 +272,7 @@ public class ZipFileSet extends FileSet {
this.dirMode =
UnixStat.DIR_FLAG | Integer.parseInt(octalString, 8);
}
/**
* @since Ant 1.6
*/
@@ -284,7 +284,8 @@ public class ZipFileSet extends FileSet {
}

/**
* A ZipFileset accepts only another ZipFileSet as reference
* A ZipFileset accepts another ZipFileSet or a FileSet as reference
* FileSets are often used by the war task for the lib attribute
*/
protected AbstractFileSet getRef(Project p) {
if (!isChecked()) {
@@ -294,8 +295,8 @@ public class ZipFileSet extends FileSet {
}

Object o = getRefid().getReferencedObject(p);
if (!(o instanceof ZipFileSet)) {
String msg = getRefid().getRefId() + " doesn\'t denote a zipfileset";
if (!(o instanceof ZipFileSet) && !(o instanceof FileSet)) {
String msg = getRefid().getRefId() + " doesn\'t denote a zipfileset or a fileset";
throw new BuildException(msg);
} else {
return (AbstractFileSet) o;


Loading…
Cancel
Save