Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.1
-
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
- relates to
-
VFS-704 Some providers wrap their input/output streams twice in a BufferedInputStream
- Resolved