The "RR Value returned by read() or skip() is never checked" error appears when a code entity ignores the result of a read() or skip() method. In this case, another entity may need to read an array of bytes of some length. The array may not be available for reading. RR.IGNORED indicates that a value returned by read() or skip() is never checked.

Example 1

14     void copyFile(String src, String dest) {
15         try {
16             File srcFile = new File(src);
17             File destFile = new File(dest);
18             FileInputStream fis =
19                     new FileInputStream(srcFile);
20             FileOutputStream fos =
21                     new FileOutputStream(destFile);
22             byte bytes[] = new byte[1024];
23             fis.read(bytes);
24             fos.write(bytes, 0, bytes.length);
25             fis.close();
26             fos.close();
27         } catch (IOException e) {
28             e.printStackTrace();
29         }
30     }

RR.IGNORED is reported for 'read' call on line 23: The value returned by 'java.io.FileInputStream.read'() method is ignored.

Security training

Application security training materials provided by Secure Code Warrior.