Mario Ivankovits wrote: > Torsten Curdt wrote: > >> So basically this means that the root >> dir was not found. >> >> May I suggest to throw an exception if the root does not >> exist? I think a FileNotFound exception would be appropriate. >> > > VFS's createFolder() method automatically create the directory with all > its parents if they do not exist. > Also if you create a file in an non existant folder this folder will be > created. > > So for VFS its not possible to throw a FileNotFoundException. :-(
Huh? Don't understand how that is related.
AFAIU in findFiles() in AbstractFileObject
it's being checked whether the root exists or not.
Instead of just skipping the traversal I would
throw an exception.
Index:
/Users/tcurdt/dev/jakarta-commons-vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
===================================================================
---
/Users/tcurdt/dev/jakarta-commons-vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
(revision 189583)
+++
/Users/tcurdt/dev/jakarta-commons-vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
(working copy)
@@ -30,6 +30,7 @@
import org.apache.commons.vfs.Selectors;
import org.apache.commons.vfs.util.RandomAccessMode;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -1359,6 +1360,10 @@
info.setFile(this);
traverse(info, selector, depthwise, selected);
}
+ else
+ {
+ throw new FileNotFoundException("root directory not
found");
+ }
}
catch (final Exception e)
{
See what I mean?
cheers
--
Torsten
signature.asc
Description: OpenPGP digital signature
