Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-437

[FTP] StackOverFlowError getting the type of a directory with a symbolic link to a parent directory with the same name

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Labels:
      None
    • Environment:

      Description

      With the setting below, StackOverFlow exceptions occur and server crashes

      set the builder.setUserDirlsRoot (opt, true)

      Attept to pull with:
      ftp://root:password@ip:/Vol1

      Vol directory has the following info
      lrwxrwxrwx 1 root root 5 Oct 5 2007 Vol1 -> /Vol1

      When it tries to look for the parent of the Vol1, it goes back to the same Vol1, which causes a infinite loop that eventually creates stackoverflow exception.

      The problem is inside the doGetType() method in FtpFileObject
      @Override
      protected FileType doGetType()
      throws Exception
      {
      // VFS-210
      synchronized (getFileSystem())
      {
      if (this.fileInfo == null)

      { getInfo(false); }

      if (this.fileInfo == UNKNOWN)

      { return FileType.IMAGINARY; }

      else if (this.fileInfo.isDirectory())

      { return FileType.FOLDER; }

      else if (this.fileInfo.isFile())

      { return FileType.FILE; }

      else if (this.fileInfo.isSymbolicLink())

      { return getLinkDestination().getType(); }

      }

      throw new FileSystemException("vfs.provider.ftp/get-type.error", getName());
      }

      It will keep hitting the "else if (this.fileinfo.isSymbolicLink())" condition and the fileinfo displayed is always the Vol1 under root directory.

      Exception is shown below
      java.lang.StackOverflowError
      at org.apache.commons.net.ftp.FTPFile.isDirectory(FTPFile.java:116)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:334)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496)
      at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:344)

        Attachments

        1. vfs-437-v2-gg.diff
          4 kB
          Gary D. Gregory
        2. VFS-437.diff
          1 kB
          Dan Tran

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jpowang Jason
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: