ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r693791 - in /ant/core/trunk/src: main/org/apache/tools/ant/DirectoryScanner.java main/org/apache/tools/ant/types/AbstractFileSet.java tests/antunit/types/fileset-test.xml
Date Wed, 10 Sep 2008 11:18:58 GMT
Author: bodewig
Date: Wed Sep 10 04:18:57 2008
New Revision: 693791

URL: http://svn.apache.org/viewvc?rev=693791&view=rev
Log:
make sure the 'correct' error is reported if the directory doesn't exist.  Sync error messages
of DirectoryScanner and AbstractFileSet.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java
    ant/core/trunk/src/tests/antunit/types/fileset-test.xml

Modified: ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java?rev=693791&r1=693790&r2=693791&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java Wed Sep 10 04:18:57
2008
@@ -806,17 +806,16 @@
                     if (!basedir.exists()) {
                         if (errorOnMissingDir) {
                             illegal = new IllegalStateException(
-                                "basedir " + basedir + " does not exist");
+                                "basedir " + basedir + " does not exist.");
                         } else {
                             // Nothing to do - basedir does not exist
                             return;
                         }
-                    }
-                    if (!basedir.isDirectory()) {
+                    } else if (!basedir.isDirectory()) {
                         illegal = new IllegalStateException("basedir "
                                                             + basedir
                                                             + " is not a"
-                                                            + " directory");
+                                                            + " directory.");
                     }
                     if (illegal != null) {
                         throw illegal;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java?rev=693791&r1=693790&r2=693791&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java Wed Sep 10 04:18:57
2008
@@ -434,7 +434,7 @@
                 }
                 if (!dir.exists() && errorOnMissingDir) {
                     throw new BuildException(dir.getAbsolutePath()
-                                             + " not found.");
+                                             + " does not exist.");
                 }
                 if (!dir.isDirectory() && dir.exists()) {
                     throw new BuildException(dir.getAbsolutePath()

Modified: ant/core/trunk/src/tests/antunit/types/fileset-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/fileset-test.xml?rev=693791&r1=693790&r2=693791&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/fileset-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/fileset-test.xml Wed Sep 10 04:18:57 2008
@@ -15,7 +15,9 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns:au="antlib:org.apache.ant.antunit" default="all">
+<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
+
+  <import file="../antunit-base.xml"/>
 
   <target name="test-fileset-missing-dir">
     <path id="missing.path.id">
@@ -30,6 +32,15 @@
     </au:assertTrue>
   </target>
 
+  <target name="test-fileset-missing-dir-exception">
+    <mkdir dir="${output}"/>
+    <au:expectfailure expectedmessage="not present does not exist">
+      <copy todir="${output}">
+        <fileset dir="not present" />
+      </copy>
+    </au:expectfailure>
+  </target>
+
   <target name="test-fileset-with-if">
     <fileset id="this.xml" dir=".">
       <include if="trigger.include" name="fileset-test.xml"/>
@@ -53,10 +64,4 @@
     <au:assertLogContains text="fileset-test.xml"/>
   </target>
 
-  <target name="all">
-    <au:antunit>
-      <fileset dir="${basedir}" includes="fileset-test.xml"/>
-      <au:plainlistener/>
-    </au:antunit>
-  </target>
 </project>



Mime
View raw message