bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/25760] New: File("mydir").list() returns null instead of


From: stephan at apache dot org
Subject: [Bug classpath/25760] New: File("mydir").list() returns null instead of File[]
Date: 12 Jan 2006 12:08:44 -0000

Hi,
I got follwing error with Ant:
Caused by: /home/stephan/debian/jonas/axis-1.2.1/xmls/targets.xml:217: IO error
scanning directory /home/stephan/debian/jonas/axis-1.2.1/lib
   at org.apache.tools.ant.DirectoryScanner.scandir
(DirectoryScanner.java:1038)

The relevant code of Ant is:
protected void scandir(File dir, String vpath, boolean fast) {
        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.");
        }
        // avoid double scanning of directories, can only happen in fast mode
        if (fast && hasBeenScanned(vpath)) {
            return;
        }
        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());
        }

After some debugging I found out that some FileNotFoundException were 
thrown like 
java.io.FileNotFoundException: Too many open files:
/home/stephan/debian/jonas/axis-1.2.1/lib/xmlParserAPIs.jar
[condition]    at gnu.java.nio.channels.FileChannelImpl.open (Native Method)
[condition]    at gnu.java.nio.channels.FileChannelImpl.<init>
(FileChannelImpl.java:124)
[condition]    at gnu.java.nio.channels.FileChannelImpl.create
(FileChannelImpl.java:116)
[condition]    at java.io.RandomAccessFile.<init> (RandomAccessFile.java:125)
[condition]    at java.util.zip.ZipFile.<init> (ZipFile.java:112)
[condition]    at org.apache.tools.ant.AntClassLoader.getResourceStream
(AntClassLoader.java:743)

The whole issue doesn't occur with Kaffe. Is there a limit of how many files
can be opened? Shouldn't throw File.list() an exception instead of returning 
null if it can't open more files?


-- 
           Summary: File("mydir").list() returns null instead of File[]
           Product: classpath
           Version: 0.19
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stephan at apache dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25760





reply via email to

[Prev in Thread] Current Thread [Next in Thread]