ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject RE: Bug in DirectoryScanner.scandir?
Date Wed, 09 Aug 2000 23:37:21 GMT
Jay,

according to the JDK javadoc, you get an empty array for an empty directory.
You get null when

"Returns null if this abstract pathname does not denote a directory, or if
an I/O error          occurs."

So perhaps it should be a BuildException.

Conor


--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au

> -----Original Message-----
> From: Jay Glanville [mailto:dickon@nortelnetworks.com]
> Sent: Thursday, 10 August 2000 2:39
> To: ant-dev@jakarta.apache.org
> Subject: Bug in DirectoryScanner.scandir?
>
>
> I've just recently started testing the Ant make tool that is part of the
> Jakarta project.  It looks very promising.  However, I think I've come
> across a little bug.
>
> The file in question is org.apache.tools.ant.DirectoryScanner and
> the method
> is scandir.  The first two lines go something like this:
>         String[] newfiles = dir.list();
>         for (int i = 0; i < newfiles.length; i++) {
> I've been getting a null pointer exception in this method.  I believe that
> dir.list() can actually return a null if the directory to be listed is
> empty?  This is the case in my department's development tree
> (designers have
> created the directories, but haven't actually submitted the code for it
> yet).
>
> A possible solution would be to place the following line:
> 	if ( newfiles == null ) return;
> in between the two above lines.  Does this solve the situation?
> It seems to
> have solved mine.
>
> If this question has asked already, apologies, but I've just joined this
> group.
>
> ------------------------------------------------------------------
> ----------
> -----
> Jay Dickon Glanville
> P066 - SiteManager Development
> 613-765-1144 (ESN 395-1144)
> MS: 045/55/A05
> E-Mail: dickon@nortelnetworks.com
>
>


Mime
View raw message