Author: jcarman
Date: Sat May 24 05:52:50 2008
New Revision: 659810

URL: http://svn.apache.org/viewvc?rev=659810&view=rev
Log:
VFS-196: FTP Provider Does Not Support Symbolic Links Correctly

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=659810&r1=659809&r2=659810&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
 Sat May 24 05:52:50 2008
@@ -24,6 +24,9 @@
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileType;
 import org.apache.commons.vfs.RandomAccessContent;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.VFS;
+import org.apache.commons.vfs.FileUtil;
 import org.apache.commons.vfs.provider.AbstractFileObject;
 import org.apache.commons.vfs.provider.UriParser;
 import org.apache.commons.vfs.util.Messages;
@@ -133,12 +136,9 @@
                final FtpClient client = ftpFs.getClient();
                try
                {
-            final FTPFile[] tmpChildren = client.listFiles(relPath);
-            if (tmpChildren == null)
-            {
-                children = null;
-            }
-            else if (tmpChildren.length == 0)
+            final String path = fileInfo != null && fileInfo.isSymbolicLink() 
? getFileSystem().getFileSystemManager().resolveName(getParent().getName(), 
fileInfo.getLink() ).getPath() : relPath;
+            final FTPFile[] tmpChildren = client.listFiles(path);
+                       if (tmpChildren == null || tmpChildren.length == 0)
                        {
                                children = EMPTY_FTP_FILE_MAP;
                        }
@@ -230,7 +230,7 @@
                 {
                     this.fileInfo = null;
                 }
-                
+
                 /* VFS-210
                 try
                                {
@@ -394,7 +394,7 @@
                         * if if this file has C children, P parents, there 
will be (C * P)
                         * listings made with (C * (P + 1)) refreshes, when 
there should
                         * really only be 1 listing and C refreshes. */
-                       
+
                        this.inRefresh = true;
                        return super.getChildren();
                }


Reply via email to