bz-62076 bz-39960 Expect the mapper to follow the FileNameMapper#mapFileName contract and move the check for null onto the entire returned array
Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/7f1685bd Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/7f1685bd Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/7f1685bd Branch: refs/heads/master Commit: 7f1685bde0a38fd33564a09ff931488aff547ca9 Parents: f3b8ace Author: Jaikiran Pai <jaiki...@apache.org> Authored: Fri Feb 9 13:31:45 2018 +0530 Committer: Jaikiran Pai <jaiki...@apache.org> Committed: Fri Feb 9 13:31:45 2018 +0530 ---------------------------------------------------------------------- src/main/org/apache/tools/ant/taskdefs/Copy.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/7f1685bd/src/main/org/apache/tools/ant/taskdefs/Copy.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index 31901a6..42f7cb7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -836,14 +836,11 @@ public class Copy extends Task { } for (int i = 0; i < toCopy.length; i++) { final String[] mappedFiles = mapper.mapFileName(toCopy[i].getName()); - for (int j = 0; j < mappedFiles.length; j++) { - if (mappedFiles[j] == null) { - throw new BuildException("Can't copy a resource without a" - + " name if the mapper doesn't" - + " provide one."); - } + if (mappedFiles == null) { + throw new BuildException("Can't copy a resource without a" + + " name if the mapper doesn't" + + " provide one."); } - if (!enableMultipleMappings) { map.put(toCopy[i], new String[] {new File(toDir, mappedFiles[0]).getAbsolutePath()});