Cornelius Höfig created VFS-726:
-----------------------------------
Summary: getInputStream(int bufferSize) on SftpFileObject
effectively ignores buffersize
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
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
(v7.6.14#76016)