commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <>
Subject [vfs] Inconsistent Behavior...
Date Tue, 29 Jan 2008 02:29:37 GMT
I am trying to use Commons VFS to download an FTP file from:

Here is my code:

FileSystemManager fsm = VFS.getManager();
FileObject remoteFile =
File tmp = File.createTempFile("download", ".txt");
final FileObject tempFile = fsm.toFileObject(tmp);
FileUtil.copyContent(remoteFile, tempFile);

Now, sometimes this runs just fine and sometimes I get an exception:

Exception in thread "main" org.apache.commons.vfs.FileSystemException:
Could not read from
because it is a not a file.
	at org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(
	at org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(
	at org.apache.commons.vfs.FileUtil.writeContent(
	at org.apache.commons.vfs.FileUtil.copyContent(

Any ideas?  Is it just a problem with the remote FTP server being
flaky?  I haven't had this trouble before with this code.

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

View raw message