IVY-1589 Prevent UnsupportedOperationException on list.remove() while doing a FileUtil.deepCopy

This commit is contained in:
Jaikiran Pai 2018-08-15 11:01:59 +05:30
parent 535eee4626
commit 556022e02a
1 changed files with 4 additions and 2 deletions

View File

@ -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 {