https://bz.apache.org/bugzilla/show_bug.cgi?id=62076master
| @@ -63,6 +63,9 @@ public class CutDirsMapper implements FileNameMapper { | |||||
| throw new BuildException("dirs must be set to a positive number"); | throw new BuildException("dirs must be set to a positive number"); | ||||
| } | } | ||||
| final char fileSep = File.separatorChar; | final char fileSep = File.separatorChar; | ||||
| if (sourceFileName == null) { | |||||
| return null; | |||||
| } | |||||
| final String fileSepCorrected = | final String fileSepCorrected = | ||||
| sourceFileName.replace('/', fileSep).replace('\\', fileSep); | sourceFileName.replace('/', fileSep).replace('\\', fileSep); | ||||
| int nthMatch = fileSepCorrected.indexOf(fileSep); | int nthMatch = fileSepCorrected.indexOf(fileSep); | ||||
| @@ -63,6 +63,9 @@ public class FilterMapper extends FilterChain implements FileNameMapper { | |||||
| * the filterchain returns an empty string. | * the filterchain returns an empty string. | ||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| if (sourceFileName == null) { | |||||
| return null; | |||||
| } | |||||
| try { | try { | ||||
| Reader stringReader = new StringReader(sourceFileName); | Reader stringReader = new StringReader(sourceFileName); | ||||
| ChainReaderHelper helper = new ChainReaderHelper(); | ChainReaderHelper helper = new ChainReaderHelper(); | ||||
| @@ -49,6 +49,7 @@ public class FlatFileNameMapper implements FileNameMapper { | |||||
| * @return the file name in a one-element array. | * @return the file name in a one-element array. | ||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| return new String[] {new java.io.File(sourceFileName).getName()}; | |||||
| return sourceFileName == null ? null | |||||
| : new String[] {new java.io.File(sourceFileName).getName()}; | |||||
| } | } | ||||
| } | } | ||||
| @@ -154,6 +154,9 @@ public class GlobPatternMapper implements FileNameMapper { | |||||
| * @return a list of converted filenames | * @return a list of converted filenames | ||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| if (sourceFileName == null) { | |||||
| return null; | |||||
| } | |||||
| String modName = modifyName(sourceFileName); | String modName = modifyName(sourceFileName); | ||||
| if (fromPrefix == null | if (fromPrefix == null | ||||
| || (sourceFileName.length() < (prefixLength + postfixLength)) | || (sourceFileName.length() < (prefixLength + postfixLength)) | ||||
| @@ -114,6 +114,9 @@ public class RegexpPatternMapper implements FileNameMapper { | |||||
| * null if the to pattern did not match | * null if the to pattern did not match | ||||
| */ | */ | ||||
| public String[] mapFileName(String sourceFileName) { | public String[] mapFileName(String sourceFileName) { | ||||
| if (sourceFileName == null) { | |||||
| return null; | |||||
| } | |||||
| if (handleDirSep) { | if (handleDirSep) { | ||||
| if (sourceFileName.indexOf("\\") != -1) { | if (sourceFileName.indexOf("\\") != -1) { | ||||
| sourceFileName = sourceFileName.replace('\\', '/'); | sourceFileName = sourceFileName.replace('\\', '/'); | ||||