From 43b12b92d9413e333bafa69bd90e86ab2fb892e0 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Thu, 10 Aug 2006 19:10:25 +0000 Subject: [PATCH] do not add directories when filesonly is true. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@430489 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 4 ++++ src/main/org/apache/tools/ant/taskdefs/Zip.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/WHATSNEW b/WHATSNEW index e2e16b2b3..d776a00a1 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -254,6 +254,10 @@ Fixed bugs: * passes the current file (name + directory) to the stylesheet/transformation. xsl-parameter name is configurable. Bugzilla report 21042. +* The API allowed creation of directories in file-only archives; a + habitual offender was the subclassed , which included META-INF/ in + the destination file regardless of whether filesonly was set to true. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index d92fd3cf6..653f7b905 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -1345,6 +1345,11 @@ public class Zip extends MatchingTask { protected void zipDir(File dir, ZipOutputStream zOut, String vPath, int mode, ZipExtraField[] extra) throws IOException { + if (doFilesonly) { + log("skipping directory " + vPath + " for file-only archive", + Project.MSG_VERBOSE); + return; + } if (addedDirs.get(vPath) != null) { // don't add directories we've already added. // no warning if we try, it is harmless in and of itself