Two problems:
1. I receive a NullPointerException from AbstractFileObject.isWriteable() when I attempt to copy VFSFTPTest.class from a local directory to one on a FTP server: org.apache.commons.vfs.FileSystemException: Could not determine if file "ftp://mss:[EMAIL PROTECTED]/home/logs/preview/VFSFTPTest.class" is writeable. at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:515) at org.apache.commons.vfs.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:891) at org.apache.commons.vfs.impl.DecoratedFileObject.copyFrom(DecoratedFileObject.java:60) at org.apache.commons.vfs.cache.OnCallRefreshFileObject.copyFrom(OnCallRefreshFileObject.java:51) at org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileObject.java:995) at org.apache.commons.vfs.impl.DecoratedFileObject.moveTo(DecoratedFileObject.java:155) at org.apache.commons.vfs.cache.OnCallRefreshFileObject.moveTo(OnCallRefreshFileObject.java:141) at VFSFTPTest.main(VFSFTPTest.java:36) Caused by: org.apache.commons.vfs.FileSystemException: Could not determine if file "ftp://mss:[EMAIL PROTECTED]/home/logs/preview" is writeable. at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:515) at org.apache.commons.vfs.impl.DecoratedFileObject.isWriteable(DecoratedFileObject.java:150) at org.apache.commons.vfs.cache.OnCallRefreshFileObject.isWriteable(OnCallRefreshFileObject.java:135) at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:508) ... 7 more Caused by: org.apache.commons.vfs.FileSystemException: Could not determine if file "ftp://mss:[EMAIL PROTECTED]/home/logs" is writeable. at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:515) at org.apache.commons.vfs.impl.DecoratedFileObject.isWriteable(DecoratedFileObject.java:150) at org.apache.commons.vfs.cache.OnCallRefreshFileObject.isWriteable(OnCallRefreshFileObject.java:135) at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:508) ... 10 more Caused by: org.apache.commons.vfs.FileSystemException: Could not determine if file "ftp://mss:[EMAIL PROTECTED]/home" is writeable. at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:515) at org.apache.commons.vfs.impl.DecoratedFileObject.isWriteable(DecoratedFileObject.java:150) at org.apache.commons.vfs.cache.OnCallRefreshFileObject.isWriteable(OnCallRefreshFileObject.java:135) at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:508) ... 13 more Caused by: java.lang.NullPointerException at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:272) at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:267) at org.apache.commons.vfs.provider.AbstractFileObject.getParent(AbstractFileObject.java:543) at org.apache.commons.vfs.provider.ftp.FtpFileObject.getInfo(FtpFileObject.java:182) at org.apache.commons.vfs.provider.ftp.FtpFileObject.refresh(FtpFileObject.java:212) at org.apache.commons.vfs.impl.DecoratedFileObject.refresh(DecoratedFileObject.java:170) at org.apache.commons.vfs.cache.OnCallRefreshFileObject.isWriteable(OnCallRefreshFileObject.java:134) at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:508) What can be preventing the library from determining if my target directory is writable? The FTP client works fine, there are no permissions issues. Though in the past (http://mail-archives.apache.org/mod_mbox/commons-user/200801.mbox/[EMAIL PROTECTED]) I've had issues with VFS giving me FTP 553 errors when there were clearly no permissions issues. Here's the code: StandardFileSystemManager manager; manager = new StandardFileSystemManager(); manager.setCacheStrategy(CacheStrategy.ON_CALL); manager.init(); try { FileObject destDir = manager.resolveFile(argv[1]); FileObject watch = manager.resolveFile(argv[0]); for(;;) { System.err.println("Monitering " + watch + " copying to " + destDir); FileObject newFiles[] = watch.findFiles(new FileDepthSelector(1,1)); if(newFiles==null) { System.err.println("Null!"); } else { System.err.println("Length == " + newFiles.length); for(int i=0; i<newFiles.length; i++) { System.err.println("Found: " + newFiles[i]); // If we're moving to a folder, we must create the file in that folder, then move its contents. FileObject destFile = destDir.resolveFile(newFiles[i].getName().getBaseName()); System.err.println("Moving " + newFiles[i] + " to " + destFile); newFiles[i].moveTo(destFile); } } Thread.currentThread().sleep(60000); } } catch(Exception e) { e.printStackTrace(); } 2. file.findFiles() will return a 0 length array, or a null array depending on the FTP server I connect to. This should be consistent, one or the other, don't you think? _________________________________________________________________ Give to a good cause with every e-mail. Join the i’m Initiative from Microsoft. http://im.live.com/Messenger/IM/Join/Default.aspx?souce=EML_WL_ GoodCause
