| Summary: | Incorrect usage of InputStream.available in ReliableFile | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | Thomas Watson <tjwatson> | ||||||
| Component: | Framework | Assignee: | Thomas Watson <tjwatson> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | ||||||||
| Version: | 3.7 | ||||||||
| Target Milestone: | Juno M1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Thomas Watson
Created attachment 198670 [details]
patch + test
After more investigation the issue is that we use the available() method to incorrectly determine the size of the file and in the case where available() returns something bigger than our default maxInputStreamBuffer then we read the whole input stream to find the CRC and then try to continue to use that fully consumed input stream. This patch fixes two issues:
1) it stops using available() to incorrectly determine the size of the file. Instead we use File.length()
2) for files larger than maxInputStreamBuffer we correctly read the complete file to obtain the CRC and then close that fully consumed input stream and then open a new input stream to be consumed by the client of the API. For smaller files < maxInputStreamBuffer we use a BufferedInputStream to correctly mark/reset after obtaining the CRC.
Created attachment 198676 [details]
updatec patch
Updated patch to make sure we don't try to use mark when the file length is longer than the integer max.
patch release. |