...
According to the Java API for the read(byte[] b, int off, int len) method:
An attempt is made to read as many as
lenbytes, but a smaller number may be read, possibly zero.
Both read methods return as soon as they find available input data. As a result, these methods can stop reading data before the array is filled because the available data may be insufficient to fill the array.
...
Incorrect use of the read() method can result in the wrong number of bytes being read or character sequences being interpreted incorrectly.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
FIO10-J | Low | Unlikely | No | NoMedium | P2P1 | L3 |
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Parasoft Jtest |
| CERT.FIO10.NASSIGIO | Ensure the return values of specified file I/O methods are used | ||||||
| SonarQube |
| S2674 |
...