From 82642e35ebe6e92921f240333be4241122adf2ce Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 27 Jul 2011 08:50:44 +0000 Subject: [PATCH] when working on resources forgot about the source resources that are not out-of date. PR 51462 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1151386 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../org/apache/tools/ant/taskdefs/Sync.java | 9 +++----- src/tests/antunit/taskdefs/sync-test.xml | 21 +++++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index cc13a8fda..13c10002e 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -70,6 +70,9 @@ Fixed bugs: * only supported a single non-fileset resource collection even though the manual said it could be multiple. + * didn't work properly when working on resource collections. + Bugzilla Report 51462. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Sync.java b/src/main/org/apache/tools/ant/taskdefs/Sync.java index 1f7210ae1..692726002 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Sync.java +++ b/src/main/org/apache/tools/ant/taskdefs/Sync.java @@ -487,13 +487,10 @@ public class Sync extends Task { protected Map scan(Resource[] resources, File toDir) { assertTrue("No mapper", mapperElement == null); - Map m = super.scan(resources, toDir); - - Iterator iter = m.keySet().iterator(); - while (iter.hasNext()) { - nonOrphans.add(((Resource) iter.next()).getName()); + for (int i = 0; i < resources.length; i++) { + nonOrphans.add(resources[i].getName()); } - return m; + return super.scan(resources, toDir); } /** diff --git a/src/tests/antunit/taskdefs/sync-test.xml b/src/tests/antunit/taskdefs/sync-test.xml index e6b202a3d..21a14426e 100644 --- a/src/tests/antunit/taskdefs/sync-test.xml +++ b/src/tests/antunit/taskdefs/sync-test.xml @@ -151,4 +151,25 @@ + + + + + + + + + + + + + + + + + + + +