Author: rgoers Date: Sun Feb 8 16:37:32 2009 New Revision: 742127 URL: http://svn.apache.org/viewvc?rev=742127&view=rev Log: Fix unit test - throw exception if child is not a directory
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java?rev=742127&r1=742126&r2=742127&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java Sun Feb 8 16:37:32 2009 @@ -27,6 +27,7 @@ import org.apache.commons.vfs.FileSystemManager; import org.apache.commons.vfs.VFS; import org.apache.commons.vfs.FileUtil; +import org.apache.commons.vfs.FileNotFolderException; import org.apache.commons.vfs.provider.AbstractFileObject; import org.apache.commons.vfs.provider.UriParser; import org.apache.commons.vfs.util.Messages; @@ -386,7 +387,20 @@ */ public FileObject[] getChildren() throws FileSystemException { - try + try + { + if (doGetType() != FileType.FOLDER) + { + throw new FileNotFolderException(getName()); + } + } + catch (Exception ex) + { + throw new FileNotFolderException(getName(), ex); + } + + + try { /* Wrap our parent implementation, noting that we're refreshing so * that we don't refresh() ourselves and each of our parents for