Author: mbenson
Date: Wed Sep 20 10:05:25 2006
New Revision: 448264

URL: http://svn.apache.org/viewvc?view=rev&rev=448264
Log:
Differentiate between no RCs specified and no matching Resources.

Modified:
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: 
http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?view=diff&rev=448264&r1=448263&r2=448264
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java 
(original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Wed 
Sep 20 10:05:25 2006
@@ -68,7 +68,7 @@
     /**
      * The build files to process.
      */
-    private Union buildFiles = new Union();
+    private Union buildFiles;
 
     /**
      * project instance for the build file currently under test.
@@ -123,6 +123,9 @@
      * adds build files to run as tests.
      */
     public void add(ResourceCollection rc) {
+        if (buildFiles == null) {
+            buildFiles = new Union();
+        }
         buildFiles.add(rc);
     }
 
@@ -156,7 +159,7 @@
     }
 
     public void execute() {
-        if (buildFiles.size() == 0) {
+        if (buildFiles == null) {
             throw new BuildException(ERROR_NO_TESTS);
         }
         doResourceCollection(buildFiles);
@@ -179,12 +182,13 @@
      * Processes a ResourceCollection.
      */
     private void doResourceCollection(ResourceCollection rc) {
+        //should relax this restriction if/when Ant core allows non-files
         if (!rc.isFilesystemOnly()) {
             throw new BuildException(ERROR_NON_FILES);
         }
 
         Iterator i = rc.iterator();
-        while(i.hasNext()) {
+        while (i.hasNext()) {
             FileResource r = (FileResource) i.next();
             if (r.isExists()) {
                 doFile(r.getFile());
@@ -439,4 +443,4 @@
         public void messageLogged(BuildEvent event) {}
     }
 
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to