From c75a494bd88e6e148918337dfb68d08013d973eb Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 9 Mar 2009 14:44:52 +0000 Subject: [PATCH] Bug 46812 - 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 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@751695 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Tar.java | 4 +-- .../tools/ant/types/ArchiveFileSet.java | 15 +++++++++ src/tests/antunit/taskdefs/tar-test.xml | 33 +++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/tests/antunit/taskdefs/tar-test.xml diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java index 69a7f083b..db3ccec8b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -676,7 +676,7 @@ public class Tar extends MatchingTask { * @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 @@ public class Tar extends MatchingTask { * @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(); diff --git a/src/main/org/apache/tools/ant/types/ArchiveFileSet.java b/src/main/org/apache/tools/ant/types/ArchiveFileSet.java index c3126f63f..84427b43a 100755 --- a/src/main/org/apache/tools/ant/types/ArchiveFileSet.java +++ b/src/main/org/apache/tools/ant/types/ArchiveFileSet.java @@ -196,6 +196,21 @@ public abstract class ArchiveFileSet extends FileSet { return null; } + /** + * 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 diff --git a/src/tests/antunit/taskdefs/tar-test.xml b/src/tests/antunit/taskdefs/tar-test.xml new file mode 100644 index 000000000..9611c5d4b --- /dev/null +++ b/src/tests/antunit/taskdefs/tar-test.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + +