git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1429613 13f79535-47bb-0310-9956-ffa450edef68master
@@ -74,6 +74,7 @@ Dan Armbrust | |||||
Daniel Henrique | Daniel Henrique | ||||
Daniel Ribagnac | Daniel Ribagnac | ||||
Daniel Spilker | Daniel Spilker | ||||
Daniel Trebbien | |||||
Danno Ferrin | Danno Ferrin | ||||
Danny Yates | Danny Yates | ||||
Dante Briones | Dante Briones | ||||
@@ -62,6 +62,10 @@ Fixed bugs: | |||||
* ssh tasks prompt for kerberos username/password under Java 7 | * ssh tasks prompt for kerberos username/password under Java 7 | ||||
Bugzilla Report 53437. | Bugzilla Report 53437. | ||||
* Zip task on <mappedresources> that excludes certain files by way of the mapper resulted in a NullPointerException | |||||
Bugzilla Report 54026 | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -319,6 +319,10 @@ | |||||
<first>Daniel</first> | <first>Daniel</first> | ||||
<last>Spilker</last> | <last>Spilker</last> | ||||
</name> | </name> | ||||
<name> | |||||
<first>Daniel</first> | |||||
<last>Trebbien</last> | |||||
</name> | |||||
<name> | <name> | ||||
<first>Danno</first> | <first>Danno</first> | ||||
<last>Ferrin</last> | <last>Ferrin</last> | ||||
@@ -1068,22 +1068,27 @@ public class Zip extends MatchingTask { | |||||
return; | return; | ||||
} | } | ||||
for (int i = 0; i < resources.length; i++) { | for (int i = 0; i < resources.length; i++) { | ||||
String name = resources[i].getName().replace(File.separatorChar, | |||||
'/'); | |||||
final Resource resource = resources[i]; | |||||
String name = resource.getName(); | |||||
if (name == null) { | |||||
continue; | |||||
} | |||||
name = name.replace(File.separatorChar, '/'); | |||||
if ("".equals(name)) { | if ("".equals(name)) { | ||||
continue; | continue; | ||||
} | } | ||||
if (resources[i].isDirectory() && doFilesonly) { | |||||
if (resource.isDirectory() && doFilesonly) { | |||||
continue; | continue; | ||||
} | } | ||||
File base = null; | File base = null; | ||||
FileProvider fp = resources[i].as(FileProvider.class); | |||||
FileProvider fp = resource.as(FileProvider.class); | |||||
if (fp != null) { | if (fp != null) { | ||||
base = ResourceUtils.asFileResource(fp).getBaseDir(); | base = ResourceUtils.asFileResource(fp).getBaseDir(); | ||||
} | } | ||||
if (resources[i].isDirectory()) { | |||||
addDirectoryResource(resources[i], name, "", base, zOut, | |||||
if (resource.isDirectory()) { | |||||
addDirectoryResource(resource, name, "", base, zOut, | |||||
ArchiveFileSet.DEFAULT_DIR_MODE, | ArchiveFileSet.DEFAULT_DIR_MODE, | ||||
ArchiveFileSet.DEFAULT_DIR_MODE); | ArchiveFileSet.DEFAULT_DIR_MODE); | ||||
@@ -1095,7 +1100,7 @@ public class Zip extends MatchingTask { | |||||
File f = (fp).getFile(); | File f = (fp).getFile(); | ||||
zipFile(f, zOut, name, ArchiveFileSet.DEFAULT_FILE_MODE); | zipFile(f, zOut, name, ArchiveFileSet.DEFAULT_FILE_MODE); | ||||
} else { | } else { | ||||
addResource(resources[i], name, "", zOut, | |||||
addResource(resource, name, "", zOut, | |||||
ArchiveFileSet.DEFAULT_FILE_MODE, | ArchiveFileSet.DEFAULT_FILE_MODE, | ||||
null, null); | null, null); | ||||
} | } | ||||
@@ -45,6 +45,21 @@ | |||||
actual="${output}/out/bar.txt"/> | actual="${output}/out/bar.txt"/> | ||||
</target> | </target> | ||||
<target name="test-54026"> | |||||
<mkdir dir="${input}"/> | |||||
<touch file="${input}/test1"/> | |||||
<mkdir dir="${input}/subdir"/> | |||||
<touch file="${input}/subdir/test2"/> | |||||
<zip destfile="${output}/br54026-destzip.zip"> | |||||
<mappedresources> | |||||
<fileset dir="${input}"/> | |||||
<globmapper from="subdir/*" to="subdir.orig/*"/> | |||||
</mappedresources> | |||||
</zip> | |||||
<au:assertFileExists file="${output}/br54026-destzip.zip"/> | |||||
</target> | |||||
<target name="testMappedClasspath"> | <target name="testMappedClasspath"> | ||||
<mkdir dir="${input}"/> | <mkdir dir="${input}"/> | ||||
<mkdir dir="${output}/out"/> | <mkdir dir="${output}/out"/> | ||||