Browse Source

Avoid NullPointerException in FileSet.

Submitted by:	Jeff Martin <jeff.martin@synamic.co.uk>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267915 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
7db9027588
2 changed files with 6 additions and 3 deletions
  1. +4
    -0
      src/main/org/apache/tools/ant/types/FileSet.java
  2. +2
    -3
      src/testcases/org/apache/tools/ant/types/CommandlineTest.java

+ 4
- 0
src/main/org/apache/tools/ant/types/FileSet.java View File

@@ -182,6 +182,10 @@ public class FileSet {
* Returns the directory scanner needed to access the files to process. * Returns the directory scanner needed to access the files to process.
*/ */
public DirectoryScanner getDirectoryScanner(Project p) { 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 * XXX remove the check here and enable the one in setDir as soon
* as we configure tasks at execution time. * as we configure tasks at execution time.


+ 2
- 3
src/testcases/org/apache/tools/ant/types/CommandlineTest.java View File

@@ -115,9 +115,8 @@ public class CommandlineTest extends TestCase {
// what the Unix sh does but causes a lot of problems on DOS // what the Unix sh does but causes a lot of problems on DOS
// based platforms otherwise // based platforms otherwise
s = Commandline.translateCommandline("1 2\\ 3 4"); 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 // now to the expected failures


Loading…
Cancel
Save