ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From glenn opdycke-hansen <glenn...@gmail.com>
Subject Re: error msg for incorrect jar/basedir value
Date Mon, 16 Jan 2006 14:41:56 GMT
This is going to be a challenge to patch.
The error is
BUILD FAILED
C:\src\ant-jar-filespec-prob\build-basedir-space.xml:58: IO error
scanning directory C:\src\ant-jar-filespec-prob\jar-root
	at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1038)
	at org.apache.tools.ant.DirectoryScanner.checkIncludePatterns(DirectoryScanner.java:836)

The DirectoryScanner.java code at 1038 is at the throw stmt below:
        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());

The code had already executed the following checks:
        if (dir == null) {
            throw new BuildException("dir must not be null.");
        } else if (!dir.exists()) {
            throw new BuildException(dir + " doesn't exists.");
        } else if (!dir.isDirectory()) {
            throw new BuildException(dir + " is not a directory.");
        }

The puzzling part is that the dir name has an extra space.  With the
space it does not exist and is not a directory.  Without the space it
does exist and is a directory.

So, should the error msg be changed?

Perhaps to the following:
            throw new BuildException("IO error scanning directory dir="""
                                     + dir.getAbsolutePath())+"""";


Note that this has caused days of lost time for the build, so a change
would be in order here.

--glenn

On 1/16/06, Jeffrey E Care <carej@us.ibm.com> wrote:
> If you are going to submit a bug report I would advise you to submit a
> patch along with it.
>
> --
> Jeffrey E. Care (carej@us.ibm.com)
> WebSphere v7 Release Engineer
> WebSphere Build Tooling Lead (Project Mantis)
>
>
> glenn opdycke-hansen <glennoph@gmail.com> wrote on 01/16/2006 08:27:38 AM:
>
> > We have seen a cryptic error message from the jar task.  If the
> > basedir directory does not exist, ant writes the following message
> >
> > BUILD FAILED
> > C:\src\ant-jar-filespec-prob\build.xml:49:
> > C:\src\ant-jar-filespec-prob\bad-base-dir-not-exists not found.
> >
> > Total time: 0 seconds
> >
> > However if the basedir value is set to an existing directory with a
> > space character appended, ant writed the following message
> >
> > BUILD FAILED
> > C:\src\ant-jar-filespec-prob\build.xml:99: IO error scanning directory
> > C:\src\ant-jar-filespec-prob\jar-root
> >
> > Total time: 2 seconds
> >
> > I plan to create a bug report, since the "IO error scanning" error
> > message is hard to understand.
> > Comments?
> >
> > --glenn
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message