Browse Source

avoid NullPointerException in DirectoryScanner.scandir.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267914 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
e2a75898e8
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      src/main/org/apache/tools/ant/DirectoryScanner.java

+ 13
- 0
src/main/org/apache/tools/ant/DirectoryScanner.java View File

@@ -727,6 +727,19 @@ strLoop:
*/
private void scandir(File dir, String vpath, boolean fast) {
String[] newfiles = dir.list();

if (newfiles == null) {
/*
* two reasons are mentioned in the API docs for File.list
* (1) dir is not a directory. This is impossible as
* we wouldn't get here in this case.
* (2) an IO error occurred (why doesn't it throw an exception
* then???)
*/
throw new BuildException("IO error scanning directory"
+ dir.getAbsolutePath());
}

for (int i = 0; i < newfiles.length; i++) {
String name = vpath+newfiles[i];
File file = new File(dir,newfiles[i]);


Loading…
Cancel
Save