Author: stevel
Date: Mon Mar 9 14:44:52 2009
New Revision: 751695
URL: http://svn.apache.org/viewvc?rev=751695&view=rev
Log:
Bug 46812 - <tarfileset> no longer takes a fileset ref (regression)
-changed the overrode the Datattype.getCheckedRef() logic in ArchiveFileSet,
delegating to the overridden getRef in all such cases; the subclasses all do
their fileset imports there. Added a test. Not changed WHATSNEW unless there's
evidence that this test fails in Ant1.7.1
Added:
ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml
- copied, changed from r750829,
ant/core/trunk/src/tests/antunit/taskdefs/unzip-test.xml
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java?rev=751695&r1=751694&r2=751695&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java Mon Mar 9
14:44:52 2009
@@ -676,7 +676,7 @@
* @return true if the collection is a fileset.
* @since Ant 1.7
*/
- protected static final boolean isFileFileSet(ResourceCollection rc) {
+ protected static boolean isFileFileSet(ResourceCollection rc) {
return rc instanceof FileSet && rc.isFilesystemOnly();
}
@@ -687,7 +687,7 @@
* @return a list of the filenames.
* @since Ant 1.7
*/
- protected static final String[] getFileNames(FileSet fs) {
+ protected static String[] getFileNames(FileSet fs) {
DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject());
String[] directories = ds.getIncludedDirectories();
String[] filesPerSe = ds.getIncludedFiles();
Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java?rev=751695&r1=751694&r2=751695&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java Mon
Mar 9 14:44:52 2009
@@ -197,6 +197,21 @@
}
/**
+ * Performs the check for circular references and returns the
+ * referenced object.
+ * This is an override which does not delegate to the superclass; instead
it invokes
+ * {...@link #getRef(Project)}, because that conains the special support
for fileset
+ * references, which can be handled by all ArchiveFileSets.
+ * @param p the Ant Project instance against which to resolve references.
+ * @return the dereferenced object.
+ * @throws BuildException if the reference is invalid (circular ref, wrong
class, etc).
+ * @since Ant 1.8
+ */
+ protected Object getCheckedRef(Project p) {
+ return getRef(p);
+ }
+
+ /**
* Prepend this prefix to the path for each archive entry.
* Prevents both prefix and fullpath from being specified
*
Copied: ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml (from r750829,
ant/core/trunk/src/tests/antunit/taskdefs/unzip-test.xml)
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml?p2=ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml&p1=ant/core/trunk/src/tests/antunit/taskdefs/unzip-test.xml&r1=750829&r2=751695&rev=751695&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/unzip-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml Mon Mar 9 14:44:52
2009
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<project name="unzip-test" default="antunit"
+<project name="tar-test" default="antunit"
xmlns:au="antlib:org.apache.ant.antunit">
<import file="../antunit-base.xml" />
@@ -24,47 +24,10 @@
<mkdir dir="${output}" />
</target>
- <target name="testFailureOnBrokenCentralDirectoryStructure">
- <au:expectfailure
- expectedmessage="central directory is empty, can't expand corrupt
archive.">
- <unzip src="broken_cd.zip" dest="${output}"/>
- </au:expectfailure>
- </target>
-
- <!-- Issue 28911 -->
- <target name="testStrippingOfPathsep">
- <mkdir dir="${input}"/>
- <mkdir dir="${output}"/>
- <touch file="${input}/file"/>
- <zip destfile="${output}/a.zip">
- <zipfileset dir="${input}" prefix="/foo"/>
- </zip>
- <unzip src="${output}/a.zip" stripAbsolutePathSpec="true"
- dest="${output}"/>
- <au:assertFileExists file="${output}/foo/file"/>
- </target>
-
- <target name="testTwoByteExtraFieldInLFH"
-
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=42940"
- >
- <mkdir dir="${input}"/>
- <mkdir dir="${output}"/>
- <copy file="zip/Bugzilla-42940.zip" tofile="${input}/test.zip"/>
- <unzip src="${input}/test.zip" dest="${output}"/>
- <au:assertFileExists file="${output}/META-INF/MANIFEST.MF"/>
- </target>
-
- <target name="testArchiveIsClosedForInvalidZips"
-
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=46559"
- >
- <mkdir dir="${input}"/>
- <mkdir dir="${output}"/>
- <copy file="zip/Bugzilla-46559.zip" tofile="${input}/test.zip"/>
- <au:expectfailure>
- <unzip src="${input}/test.zip" dest="${output}"/>
- </au:expectfailure>
- <delete file="${input}/test.zip" quiet="true"/>
- <!-- failed on Windows and other OSes with implicit file locking -->
- <au:assertFileDoesntExist file="${input}/test.zip"/>
+ <target name="testTarFilesetHandlesFilesetReferences" depends="setUp">
+ <fileset id="xml.fileset" dir="." includes="*.xml" />
+ <tar destfile="${output}/testtar.tar">
+ <tarfileset prefix="pre" refid="xml.fileset" />
+ </tar>
</target>
</project>