commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <>
Subject [VFS]: NPE in FileObject.getType().getChildren()
Date Fri, 21 May 2004 03:30:48 GMT
Hi All,

I am getting an NPE in the following line of code, and I think it must be
thread related or something. More on that in a sec.

In this code within Chainsaw v2, the line highlighted:

    FileObject[] fos = vfsNode.getFileObject().getChildren();
    Collection objects = new ArrayList(Arrays.asList(fos));
    for (Iterator iter = objects.iterator(); iter.hasNext();) {
        FileObject fo = (FileObject);
****        if(fo.getType().hasChildren()) {

I get a stack trace:

	at org.apache.log4j.chainsaw.vfs.VFSPlugin$
	at Source)

If I debug, and place and break point on this line and step over, it all
works fine.  Only when NOT debugging.

The line in question appears to be:

    public FileObject[] getChildren() throws FileSystemException
****        if (!type.hasChildren())
            throw new
FileSystemException("vfs.provider/list-children-not-folder.error", name);

The particular FileObject that seems to die on me is actually a locally
mapped Windows share drive.  I am getting all the Root drives in the local
filesystem with the following code:

   File[] roots = File.listRoots();
    for (int i = 0; i < roots.length; i++) {
        File root = roots[i];

        // Add the authors of the class to the list of people
to "have a word" with... This is ridiculous...
        if (!(root.getAbsolutePath().toLowerCase().startsWith("a:") ||
root.getAbsolutePath().toLowerCase().startsWith("b:"))) {
            if(root.exists() && root.canRead()) {
                FileObject fileObject = this.fileSystemManager
                DefaultMutableTreeNode node = this.fileSystemTree
                .addFileObject("local:" + root.getAbsolutePath(),
      "Adding " +

[sidenote: that I can't work out how to stop Java from polling the floppy
drives and causing an error, any clues welcome]

My "H:" drive is a windows domain mapped drive.  Looks like there might be
some timing issue between the population of the type property of the
FileObject, but it only happens on these mapped drives, and ONLY when I am
not debugging through it.

Anyone seen anything like this?


Paul Smith

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message