Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 98685 invoked from network); 29 Oct 2010 15:53:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Oct 2010 15:53:29 -0000 Received: (qmail 60496 invoked by uid 500); 29 Oct 2010 15:53:29 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 60411 invoked by uid 500); 29 Oct 2010 15:53:27 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 60386 invoked by uid 99); 29 Oct 2010 15:53:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Oct 2010 15:53:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Oct 2010 15:53:21 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0469E23889ED; Fri, 29 Oct 2010 15:52:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1028813 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Zip.java src/tests/antunit/taskdefs/zip-test.xml Date: Fri, 29 Oct 2010 15:52:23 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101029155224.0469E23889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Fri Oct 29 15:52:23 2010 New Revision: 1028813 URL: http://svn.apache.org/viewvc?rev=1028813&view=rev Log: zip's whenempty doesn't look at non-filesets at all. PR 50115 Modified: ant/core/trunk/WHATSNEW ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1028813&r1=1028812&r2=1028813&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Fri Oct 29 15:52:23 2010 @@ -187,6 +187,11 @@ Fixed bugs: updating a file. Bugzilla Report 50049. + * 's whenEmpty behavior never consulted the non-fileset + resources so the task could fail even though resources have been + provided using non-fileset resource collections. + Bugzilla Issue 50115. + Other changes: -------------- Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=1028813&r1=1028812&r2=1028813&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Fri Oct 29 15:52:23 2010 @@ -1243,6 +1243,19 @@ public class Zip extends MatchingTask { return new ArchiveState(as2.isOutOfDate(), toAdd); } + /* + * This is yet a hacky construct to extend the getResourcesToAdd + * method so we can pass the information whether non-fileset + * resources have been available to it without having to move the + * withEmpty behavior checks (since it would break subclasses in + * several ways otherwise). + */ + private static ThreadLocal haveNonFileSetResourcesToAdd = new ThreadLocal() { + protected Object initialValue() { + return Boolean.FALSE; + } + }; + /** * Collect the resources that are newer than the corresponding * entries (or missing) in the original archive. @@ -1272,6 +1285,7 @@ public class Zip extends MatchingTask { Resource[][] initialResources = grabResources(filesets); if (isEmpty(initialResources)) { + if (Boolean.FALSE.equals(haveNonFileSetResourcesToAdd.get())) { if (needsUpdate && doUpdate) { /* * This is a rather hairy case. @@ -1314,6 +1328,10 @@ public class Zip extends MatchingTask { needsUpdate = true; } } + } + + // either we there are non-fileset resources or we + // (re-)create the archive anyway return new ArchiveState(needsUpdate, initialResources); } @@ -1429,7 +1447,9 @@ public class Zip extends MatchingTask { */ Resource[][] initialResources = grabNonFileSetResources(rcs); - if (isEmpty(initialResources)) { + boolean empty = isEmpty(initialResources); + haveNonFileSetResourcesToAdd.set(Boolean.valueOf(!empty)); + if (empty) { // no emptyBehavior handling since the FileSet version // will take care of it. return new ArchiveState(needsUpdate, initialResources); @@ -1934,6 +1954,7 @@ public class Zip extends MatchingTask { resources.removeElement(zf); } filesetsFromGroupfilesets.removeAllElements(); + haveNonFileSetResourcesToAdd.set(Boolean.FALSE); } /** Modified: ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml?rev=1028813&r1=1028812&r2=1028813&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml Fri Oct 29 15:52:23 2010 @@ -125,12 +125,33 @@ + + + - + - + + + + + + + + + + + + + + + + + +