RR.IGNORED

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

Copy
     void copyFile(String src, String dest) {
         try {
             File srcFile = new File(src);
             File destFile = new File(dest);
             FileInputStream fis =
                     new FileInputStream(srcFile);
             FileOutputStream fos =
                     new FileOutputStream(destFile);
             byte bytes[] = new byte[1024];
             fis.read(bytes);
             fos.write(bytes, 0, bytes.length);
             fis.close();
             fos.close();
         } catch (IOException e) {
             e.printStackTrace();
         }
     }

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.