bodewig 00/08/10 01:56:14
Modified: src/main/org/apache/tools/ant/types FileSet.java
src/testcases/org/apache/tools/ant/types
CommandlineTest.java
Log:
Avoid NullPointerException in FileSet.
Submitted by: Jeff Martin <[EMAIL PROTECTED]>
Revision Changes Path
1.6 +4 -0
jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java
Index: FileSet.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FileSet.java 2000/08/01 09:18:40 1.5
+++ FileSet.java 2000/08/10 08:56:14 1.6
@@ -182,6 +182,10 @@
* Returns the directory scanner needed to access the files to process.
*/
public DirectoryScanner getDirectoryScanner(Project p) {
+ if (dir == null) {
+ throw new BuildException("No directory specified for fileset.");
+ }
+
/*
* XXX remove the check here and enable the one in setDir as soon
* as we configure tasks at execution time.
1.5 +2 -3
jakarta-ant/src/testcases/org/apache/tools/ant/types/CommandlineTest.java
Index: CommandlineTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/types/CommandlineTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CommandlineTest.java 2000/08/10 08:42:30 1.4
+++ CommandlineTest.java 2000/08/10 08:56:14 1.5
@@ -115,9 +115,8 @@
// what the Unix sh does but causes a lot of problems on DOS
// based platforms otherwise
s = Commandline.translateCommandline("1 2\\ 3 4");
- assertEquals("case with quotes whitespace", 4, s.length);
- assertEquals("Single quotes stripped, double quote included", "2\\",
- s[1]);
+ assertEquals("case with quoted whitespace", 4, s.length);
+ assertEquals("backslash included", "2\\", s[1]);
// now to the expected failures