Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.18.0
-
None
Description
The implementation of InputStream does not return -1 for eof.
The java doc of InputStream said "The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0."
For FileInputStream, it allows skipping any number of bytes past the end of the file.
So the method "seek" of InputStreamFSInputWrapper will cause infinite loop if
desired exceed end of file
I reproduced with following case
byte[] bytes = "flink".getBytes(); try (InputStream inputStream = new ByteArrayInputStream(bytes)){ InputStreamFSInputWrapper wrapper = new InputStreamFSInputWrapper(inputStream); wrapper.seek(20); }
I found an issue of commons-io talks about the problem of skip
https://issues.apache.org/jira/browse/IO-203
Attachments
Issue Links
- links to