Repository: ant
Updated Branches:
  refs/heads/master 495c0ed8e -> 1fbf71253


make sure destPath doesn't leak into dependency path


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/1fbf7125
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/1fbf7125
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/1fbf7125

Branch: refs/heads/master
Commit: 1fbf712537a179f9e1b3aa172e83cfef9a2eefe9
Parents: 495c0ed
Author: Stefan Bodewig <bode...@apache.org>
Authored: Wed Feb 14 09:49:38 2018 +0100
Committer: Stefan Bodewig <bode...@apache.org>
Committed: Wed Feb 14 09:49:38 2018 +0100

----------------------------------------------------------------------
 .../tools/ant/taskdefs/optional/depend/Depend.java    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/1fbf7125/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java 
b/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
index e31b496..0834dbe 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -44,8 +45,8 @@ import org.apache.tools.ant.taskdefs.rmic.DefaultRmicAdapter;
 import org.apache.tools.ant.taskdefs.rmic.WLRmic;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
-import org.apache.tools.ant.types.resources.Difference;
 import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.depend.DependencyAnalyzer;
@@ -244,16 +245,17 @@ public class Depend extends MatchingTask {
         if (dependClasspath == null) {
             return null;
         }
-        Difference diff = new Difference();
-        diff.add(destPath);
-        diff.add(dependClasspath);
+
+        Set<Resource> dependNotInDest = new LinkedHashSet<>();
+        dependClasspath.forEach(dependNotInDest::add);
+        destPath.forEach(dependNotInDest::remove);
 
         Path p;
-        if (diff.isEmpty()) {
+        if (dependNotInDest.isEmpty()) {
             p = null;
         } else {
             p = new Path(getProject());
-            p.add(diff);
+            dependNotInDest.forEach(p::add);
         }
 
         log("Classpath without dest dir is " + p, Project.MSG_DEBUG);

Reply via email to