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

getInputStream(int bufferSize) on SftpFileObject effectively ignores buffer size

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.1
    • 2.5.0
    • None
    • Important

    Description

      When calling getInputStream(int bufferSize) on an SftpFileObject

      the callstack looks like this :

      at java.io.BufferedInputStream.<init>(BufferedInputStream.java:199)
      at java.io.BufferedInputStream.<init>(BufferedInputStream.java:183)
      at org.apache.commons.vfs2.util.MonitorInputStream.<init>(MonitorInputStream.java:40)
      at org.apache.commons.vfs2.provider.sftp.SftpFileObject$SftpInputStream.<init>(SftpFileObject.java:485)
      at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doGetInputStream(SftpFileObject.java:455)
      at org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1175)
      at org.apache.commons.vfs2.provider.DefaultFileContent.buildInputStream(DefaultFileContent.java:495)
      at org.apache.commons.vfs2.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:356)

      The problem is that when initialising the BufferedInputstream it is done with the DEFAULT_BUFFER_SIZE of 8192.

      The problem seems to be that in DefaultFileContent.buildInputStream(final Integer bufferSize) the it tries to get a raw InputStream and then wrap it into a FileContentInputStream but in reality the fileObject.getInputStream() in line 495 already returns a BufferedInputStream instead of a raw InputStream. It is effectively double buffered.

       

      Attachments

        Issue Links

          Activity

            People

              ggregory Gary D. Gregory
              GeeGee Cornelius Höfig
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4h
                  4h
                  Remaining:
                  Remaining Estimate - 4h
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified