Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 99038 invoked from network); 26 Feb 2008 23:59:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Feb 2008 23:59:39 -0000 Received: (qmail 36020 invoked by uid 500); 26 Feb 2008 23:59:34 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 35995 invoked by uid 500); 26 Feb 2008 23:59:34 -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 35986 invoked by uid 99); 26 Feb 2008 23:59:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2008 15:59:34 -0800 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.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2008 23:59:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EB35A1A9838; Tue, 26 Feb 2008 15:59:17 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r631430 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Date: Tue, 26 Feb 2008 23:59:17 -0000 To: notifications@ant.apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080226235917.EB35A1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mbenson Date: Tue Feb 26 15:59:16 2008 New Revision: 631430 URL: http://svn.apache.org/viewvc?rev=631430&view=rev Log: bz 44493 task cannot differentiate between "no resources specified" and "no resources found" Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java?rev=631430&r1=631429&r2=631430&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Tue Feb 26 15:59:16 2008 @@ -103,7 +103,7 @@ /** * files to load */ - private Union resources = new Union(); + private Union resources; /** * SQL statement @@ -255,6 +255,14 @@ * @since Ant 1.7 */ public void add(ResourceCollection rc) { + if (rc == null) { + throw new BuildException("Cannot add null ResourceCollection"); + } + synchronized (this) { + if (resources == null) { + resources = new Union(); + } + } resources.add(rc); } @@ -399,8 +407,7 @@ sqlCommand = sqlCommand.trim(); try { - if (srcFile == null && sqlCommand.length() == 0 - && resources.size() == 0) { + if (srcFile == null && sqlCommand.length() == 0 && resources == null) { if (transactions.size() == 0) { throw new BuildException("Source file or resource collection, " + "transactions or sql statement " @@ -413,13 +420,15 @@ + " is not a file!", getLocation()); } - // deal with the resources - Iterator iter = resources.iterator(); - while (iter.hasNext()) { - Resource r = (Resource) iter.next(); - // Make a transaction for each resource - Transaction t = createTransaction(); - t.setSrcResource(r); + if (resources != null) { + // deal with the resources + Iterator iter = resources.iterator(); + while (iter.hasNext()) { + Resource r = (Resource) iter.next(); + // Make a transaction for each resource + Transaction t = createTransaction(); + t.setSrcResource(r); + } } // Make a transaction group for the outer command