[
https://issues.apache.org/jira/browse/VFS-726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Cornelius Höfig closed VFS-726.
-------------------------------
Code verified, looks good
> getInputStream(int bufferSize) on SftpFileObject effectively ignores buffer
> size
> --------------------------------------------------------------------------------
>
> Key: VFS-726
> URL: https://issues.apache.org/jira/browse/VFS-726
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.4.1
> Reporter: Cornelius Höfig
> Assignee: Gary D. Gregory
> Priority: Minor
> Fix For: 2.5.0
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> 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.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)