commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject Re: [vfs] Inconsistent Behavior...
Date Tue, 29 Jan 2008 13:44:00 GMT
Here's the complete output in case that helps:

01-29@08:39:46 INFO  (DefaultFileReplicator)     - Using
"C:\Users\jcarman\AppData\Local\Temp\vfs_cache" as temporary files
store.
01-29@08:39:46 DEBUG (StandardFileSystemManager)     - Skipping
provider "org.apache.commons.vfs.provider.sftp.SftpFileProvider"
because required class "com.jcraft.jsch.JSch" is not available.
01-29@08:39:46 DEBUG (StandardFileSystemManager)     - Skipping
provider "org.apache.commons.vfs.provider.smb.SmbFileProvider" because
required class "jcifs.smb.SmbFile" is not available.
01-29@08:39:47 DEBUG (SoftRefFilesCache)     - putFile:
ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current/homologene.data
01-29@08:39:47 DEBUG (SoftRefFilesCache)     - putFile: ftp://ftp.ncbi.nih.gov/
01-29@08:39:47 DEBUG (SoftRefFilesCache)     - putFile:
ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current
01-29@08:39:47 DEBUG (SoftRefFilesCache)     - putFile:
ftp://ftp.ncbi.nih.gov/pub/HomoloGene
01-29@08:39:47 DEBUG (SoftRefFilesCache)     - putFile:
ftp://ftp.ncbi.nih.gov/pub
01-29@08:39:51 DEBUG (SoftRefFilesCache)     - putFile:
file:///C:/Users/jcarman/AppData/Local/Temp/download43539.txt
Exception in thread "main" org.apache.commons.vfs.FileSystemException:
Could not read from
"ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current/homologene.data"
because it is a not a file.
	at org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1149)
	at org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:360)
	at org.apache.commons.vfs.FileUtil.writeContent(FileUtil.java:71)
	at org.apache.commons.vfs.FileUtil.copyContent(FileUtil.java:103)
	at com.myco.MyLoader.main(MyLoader.java:83)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)


On 1/28/08, James Carman <james@carmanconsulting.com> wrote:
> I am trying to use Commons VFS to download an FTP file from:
>
> ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current/homologene.data
>
> Here is my code:
>
> FileSystemManager fsm = VFS.getManager();
> FileObject remoteFile =
> fsm.resolveFile("ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current/homologene.data");
> File tmp = File.createTempFile("download", ".txt");
> tmp.deleteOnExit();
> 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
> "ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current/homologene.data"
> because it is a not a file.
>         at org.apache.commons.vfs.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1149)
>         at org.apache.commons.vfs.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:360)
>         at org.apache.commons.vfs.FileUtil.writeContent(FileUtil.java:71)
>         at org.apache.commons.vfs.FileUtil.copyContent(FileUtil.java:103)
>
> 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: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message