Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 46268 invoked from network); 23 Nov 2005 18:16:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Nov 2005 18:16:51 -0000 Received: (qmail 93204 invoked by uid 500); 23 Nov 2005 18:16:49 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 93164 invoked by uid 500); 23 Nov 2005 18:16:49 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 93152 invoked by uid 500); 23 Nov 2005 18:16:49 -0000 Received: (qmail 93148 invoked by uid 99); 23 Nov 2005 18:16:49 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 23 Nov 2005 10:16:49 -0800 Received: (qmail 45775 invoked by uid 65534); 23 Nov 2005 18:16:29 -0000 Message-ID: <20051123181629.45762.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r348510 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java Date: Wed, 23 Nov 2005 18:16:28 -0000 To: ant-cvs@apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: mbenson Date: Wed Nov 23 10:16:24 2005 New Revision: 348510 URL: http://svn.apache.org/viewcvs?rev=348510&view=rev Log: allow empty after all. Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java?rev=348510&r1=348509&r2=348510&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java Wed Nov 23 10:16:24 2005 @@ -77,11 +77,14 @@ private class MyIterator implements Iterator { Iterator rci = rc.iterator(); Iterator ri = null; + public boolean hasNext() { - if ((ri == null || !ri.hasNext()) && rci.hasNext()) { + boolean result = ri != null && ri.hasNext(); + while (!result && rci.hasNext()) { ri = ((ResourceCollection) rci.next()).iterator(); + result = ri.hasNext(); } - return ri != null && ri.hasNext(); + return result; } public Object next() { if (!hasNext()) { @@ -95,7 +98,7 @@ } } - private Vector rc = null; + private Vector rc = new Vector(); private Collection coll = null; /** @@ -106,7 +109,9 @@ if (isReference()) { throw noChildrenAllowed(); } - rc = (rc == null) ? new Vector() : rc; + if (c == null) { + return; + } rc.add(c); FailFast.invalidate(this); coll = null; @@ -146,18 +151,9 @@ return getRef().isFilesystemOnly(); } validate(); - //first the easy way, if all children are filesystem-only, return true: - boolean goEarly = true; - for (Iterator i = rc.iterator(); goEarly && i.hasNext();) { - goEarly &= ((ResourceCollection) i.next()).isFilesystemOnly(); - } - if (goEarly) { - return true; - } - /* now check each Resource in case the child only - lets through files from any children IT may have: */ - for (Iterator i = coll.iterator(); i.hasNext();) { - if (!(i.next() instanceof FileResource)) { + + for (Iterator i = rc.iterator(); i.hasNext();) { + if ((!((ResourceCollection) i.next()).isFilesystemOnly())) { return false; } } @@ -200,9 +196,6 @@ private synchronized void validate() { dieOnCircularReference(); - if (rc == null || rc.size() == 0) { - throw new BuildException("Resources: no resources specified."); - } coll = (coll == null) ? new MyCollection() : coll; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org