You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2018/08/15 05:32:30 UTC
ant-ivy git commit: IVY-1589 Prevent UnsupportedOperationException on
list.remove() while doing a FileUtil.deepCopy
Repository: ant-ivy
Updated Branches:
refs/heads/master 535eee462 -> 556022e02
IVY-1589 Prevent UnsupportedOperationException on list.remove() while doing a FileUtil.deepCopy
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/556022e0
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/556022e0
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/556022e0
Branch: refs/heads/master
Commit: 556022e02a34081819991e4c2e4a11e99d2c9c7c
Parents: 535eee4
Author: Jaikiran Pai <ja...@apache.org>
Authored: Wed Aug 15 11:01:59 2018 +0530
Committer: Jaikiran Pai <ja...@apache.org>
Committed: Wed Aug 15 11:01:59 2018 +0530
----------------------------------------------------------------------
src/java/org/apache/ivy/util/FileUtil.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/556022e0/src/java/org/apache/ivy/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/FileUtil.java b/src/java/org/apache/ivy/util/FileUtil.java
index 38168c0..5963d4e 100644
--- a/src/java/org/apache/ivy/util/FileUtil.java
+++ b/src/java/org/apache/ivy/util/FileUtil.java
@@ -171,7 +171,7 @@ public final class FileUtil {
// existing folder, gather existing children
File[] children = dest.listFiles();
if (children != null) {
- existingChild = Arrays.asList(children);
+ existingChild = new ArrayList<>(Arrays.asList(children));
}
}
} else {
@@ -185,7 +185,9 @@ public final class FileUtil {
// compute the destination file
File childDest = new File(dest, cf.getName());
// if file existing, 'mark' it as taken care of
- existingChild.remove(childDest);
+ if (!existingChild.isEmpty()) {
+ existingChild.remove(childDest);
+ }
if (cf.isDirectory()) {
deepCopy(cf, childDest, l, overwrite);
} else {