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

[SFTP] Add support for append mode.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.3
    • Labels:
      None
    • Environment:

      Description

      I am trying to append content to a sftp file. but vfs seems not supports that.

       

      My test code: 

      FileObject file = fsManager.resolveFile("sftp://root:xxx@192.168.1.1:22/sftpappend.txt" );
      if (!file.exists()) {
          file.createFile();
      }
      
      FileContent content = file.getContent();
      OutputStream outputStream = content.getOutputStream(true);
      

       

      Error info :

      org.apache.commons.vfs2.FileSystemException: The file type does not support append mode.
      
      at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1180)
      at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:413)
      

      I checked the source code. seems its easy to support APPEND option in sftp. Why commons-vfs doesn't do that?

      org.apache.commons.vfs2.provider.sftp.SftpFileObject#doGetOutputStream

        Attachments

        1. image-2018-10-25-11-10-10-799.png
          63 kB
          dingxbcn
        2. image-2018-10-25-13-48-58-673.png
          90 kB
          dingxbcn
        3. image-2018-10-25-13-49-13-334.png
          171 kB
          dingxbcn

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dingxb dingxbcn
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m