ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant DirectoryScanner.java
Date Thu, 10 Aug 2000 08:49:59 GMT
bodewig     00/08/10 01:49:58

  Modified:    src/main/org/apache/tools/ant DirectoryScanner.java
  Log:
  avoid NullPointerException in DirectoryScanner.scandir.
  
  Revision  Changes    Path
  1.5       +13 -0     jakarta-ant/src/main/org/apache/tools/ant/DirectoryScanner.java
  
  Index: DirectoryScanner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DirectoryScanner.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DirectoryScanner.java	2000/08/04 10:24:30	1.4
  +++ DirectoryScanner.java	2000/08/10 08:49:58	1.5
  @@ -727,6 +727,19 @@
        */
       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]);
  
  
  

Mime
View raw message