git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@437804 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -273,6 +273,8 @@ Fixed bugs: | |||||
| * mixing of add and addConfigured methods in Mapper/ChainedMapper | * mixing of add and addConfigured methods in Mapper/ChainedMapper | ||||
| causes incorrect chaining. Bugzilla report 40228. | causes incorrect chaining. Bugzilla report 40228. | ||||
| * <zip filesonly="true"> included empty directories. Bugzilla report 40258. | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| @@ -157,6 +157,17 @@ | |||||
| </fail> | </fail> | ||||
| </target> | </target> | ||||
| <!-- Bugzilla Report 40258 --> | |||||
| <target name="zipEmptyDirFilesOnly"> | |||||
| <mkdir dir="empty/empty2" /> | |||||
| <zip destfile="test3.zip" basedir="empty" update="true" filesonly="true" /> | |||||
| <fail message="archive should get skipped"> | |||||
| <condition> | |||||
| <available file="test3.zip" /> | |||||
| </condition> | |||||
| </fail> | |||||
| </target> | |||||
| <target name="zipEmptyCreate"> | <target name="zipEmptyCreate"> | ||||
| <mkdir dir="empty"/> | <mkdir dir="empty"/> | ||||
| <zip destfile="test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/> | <zip destfile="test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/> | ||||
| @@ -1269,10 +1269,12 @@ public class Zip extends MatchingTask { | |||||
| ((ZipScanner) rs).setEncoding(encoding); | ((ZipScanner) rs).setEncoding(encoding); | ||||
| } | } | ||||
| Vector resources = new Vector(); | Vector resources = new Vector(); | ||||
| String[] directories = rs.getIncludedDirectories(); | |||||
| for (int j = 0; j < directories.length; j++) { | |||||
| if (!"".equals(directories[j]) || !skipEmptyNames) { | |||||
| resources.addElement(rs.getResource(directories[j])); | |||||
| if (!doFilesonly) { | |||||
| String[] directories = rs.getIncludedDirectories(); | |||||
| for (int j = 0; j < directories.length; j++) { | |||||
| if (!"".equals(directories[j]) || !skipEmptyNames) { | |||||
| resources.addElement(rs.getResource(directories[j])); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| String[] files = rs.getIncludedFiles(); | String[] files = rs.getIncludedFiles(); | ||||
| @@ -137,6 +137,10 @@ public class ZipTest extends BuildFileTest { | |||||
| public void testZipEmptyDir() { | public void testZipEmptyDir() { | ||||
| executeTarget("zipEmptyDir"); | executeTarget("zipEmptyDir"); | ||||
| } | } | ||||
| // Bugzilla Report 40258 | |||||
| public void testZipEmptyDirFilesOnly() { | |||||
| executeTarget("zipEmptyDirFilesOnly"); | |||||
| } | |||||
| public void testZipEmptyCreate() { | public void testZipEmptyCreate() { | ||||
| expectLogContaining("zipEmptyCreate", "Note: creating empty"); | expectLogContaining("zipEmptyCreate", "Note: creating empty"); | ||||
| } | } | ||||