Browse Source

bz-62076 bz-39960 Expect the mapper to follow the FileNameMapper#mapFileName contract and move the check for null onto the entire returned array

master
Jaikiran Pai 7 years ago
parent
commit
7f1685bde0
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      src/main/org/apache/tools/ant/taskdefs/Copy.java

+ 4
- 7
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -836,14 +836,11 @@ public class Copy extends Task {
} }
for (int i = 0; i < toCopy.length; i++) { for (int i = 0; i < toCopy.length; i++) {
final String[] mappedFiles = mapper.mapFileName(toCopy[i].getName()); 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) { if (!enableMultipleMappings) {
map.put(toCopy[i], map.put(toCopy[i],
new String[] {new File(toDir, mappedFiles[0]).getAbsolutePath()}); new String[] {new File(toDir, mappedFiles[0]).getAbsolutePath()});


Loading…
Cancel
Save